git init

Work on Multiple Sub Projects at the Same Time (Git Branches)

Instead of always working and commiting against the master branch you can create local branches as a way to work on multiple software features within the same git project.  This allows you to work on the same files, maintain seperate versions of them, and keep track of it all.  For example, when you’re working on the same file(s) but might not want to put that new feature in yet, but still need to support existing code with a hotfix.

 

Create new branch named “feature12” and switch to it.  This will be a local branch only.

 

Do your work and commit your changes

 

Switch back to master.

 

At this point you could start another branch if you needed to work on feature 13.  You’d just go back to the 1st step.  But let’s say you didn’t want to do that, but instead you want to merge your new feature 12 code in with master.

 

Merge your new stuff in the master branch.

 

Now that you’ve merged it into the master branch you no longer need the feature12 branch.

 

Remove branch

 

Push