Branching strategy - emiln/majic GitHub Wiki
Merging and Branching
Oh god, what is this atrocity?
This time-honored quote by any person ever viewing another person's merging and branching with Git is a sad testament to the fact that people do not really agree on what constitutes proper merging and branching of code.
Our project tackles the issue with steely resolve and regulatory bureaucracy, and simply states what you must do when merging and branching in order to be a functional member of the project. This trades art and soulfulness for something that hopefully works like a well-oiled machine in practice.
While these are to be considered general rules, there is nothing amiss in suggesting improvements to the rules.
Branching
When do I create a new branch?
As soon as you start working on an issue in the Issue Tracker.
What if I am doing something unrelated to our issues?
Then you should not be changing any code at all. Stop whatever you're doing and either pick an issue or create a new one. You are clearly up to no good.
What do I call my new branch?
See the Wiki section about branch naming conventions.
Do I push my branch to Github or just keep it on my local machine?
This is ultimately of little importance as it will be deleted as soon as your work has been merged into its receiving branch. There are two minor aspects to consider:
- If you keep your branch on a local machine and never push to Github, you can safely rebase it to your heart's content.
- If you are prevented from continuing your work on the issue for any reason, having it on Github will enable other project collaborators to quickly pick up where you left.
If you do not care about rebasing, there is really no reason not to push your branch to Github.
Merging
My branch now contains precisely the changes I want. What now?
Now you create a pull request to the receiving branch of your changes. Project collaborators will then descend upon your changes with a barrage of comments. When all, if any, outstanding issues with your pull request have been resolved, someone with sufficient privileges will carry out the merging.