AppyPrinciplesGetting started
git's cheat sheet Work on a branch

Tired of working on a deckchair? Try working on a branch.

This page is for you, freshly graduated worker, as you join a team where you have not yet been granted full control over the main codebase.

You are asked to work on a branch: a copy of the main codebase where you will, depending on your abilities and experience, perform silly or innovative changes without perturbating the lead developer.

Once you are done with your changes, you may ask the boss to merge your branch into the main codebase. This person will do it as explained here. At least, if she is in the appropriate mood and if your work deserves this honour.

As a first step, create a clone of the distant repository you are woking on.

Then, after you have cd'ed into your local repo, create a branch in it and switch to it. As explained here, there is a single command allowing you to perform both actions at once. Suppose you want to name your branch hateYouBoss. The command will be:

git checkout -b hateYouBoss

Tip · If you work during a long period of time on your branch, please regularly merge the main branch into yours. That way, you will ensure your code sticks to the lastest codebase and works with it. Moreover, when the branch will be merged by the boss, it will be easier for him because the diff will be simpler: it will not be polluted by elements from the main branch that would not have been merged in the branch for many days.