Details
Here’s an intermediate Git workflow you can use to practice branching, staging files and making commits.
Setup
- Create your project folder.
- Create some files and write some code.
- Initialize the Git repo.
- Make an initial commit on the master branch (this is so the master branch will actually get created).
- Create a feature/topic branch and switch to it.
The second and third steps in the setup can be flipped if you prefer to initialize the repo first.
Workflow
- Write some code and save your files.
- Stage your files. You can either stage all of them or just some of them.
- Commit the changes.
- After you’ve completed your feature, you can merge the changes into the master branch.
- Create a new branch when it’s time to add more changes.
Exercises
There are no exercises for this lesson.
References
Recording Changes to the Repository from the Git Pro book
Basic Branching and Merging from the Git Pro book