Information Technology Reference
In-Depth Information
This chapter reflects the way I usually teach branching and merging. I strongly be-
lieve that a key point while learning the git branching model is to grasp the way this
operation transforms the graph of revisions. Once you understand how to create a
graph with a predefined structure, merging becomes easy and straightforward.
This chapter covers three cases of merging:
• A fast-forward
• Merging of two diverged branches
• Merging of multiple diverged branches
To practice these merges we will need to create:
• A repository with two branches, one of them has to be merged in the other
• A repository with two diverged branches
• And a repository with multiple diverged branches
All of these repositories will be created in separate recipes making it easier to repeat
every case a number of times, if necessary. Anytime you want to perform a merge
again, just clone a starting repository and execute the commands that merge branches.
Working this way, you can, for example, test and analyze how diverse options of the $
git merge command influences its behavior.
In addition, this chapter explains:
• How to undo the merge operation
• How to force a fast-forward to be realized as a typical merge using the --
no-ff switch
• How to make sure that a merge is a fast-forward with the --ff-only
switch
• How to use n-th parent references
6-1. Implementing a new feature in a
branch
Search WWH ::




Custom Search