Fast-forward merge
Key Points
- Merging combines work done on one branch with work done on another branch.
- Git performs three-way merges to combine content.
- Ours refers to the branch to which you want to pull changes into; theirs refers to the branch that has the changes you want to pull into ours.
git log <theirs> --not <ours>
shows you what commits are on the branch you want to merge, that aren’t in your branch already.
git merge <theirs>
merges the commits on the “theirs” branch into “our” branch.
- Git automatically creates a merge commit message for you, and lets you edit it before continuing with the merge.
- A fast-forward merge happens when there have been no changes to “ours” since you branched off “theirs”, and results in no merge commit being made.
- To prevent a fast-forward merge and create a merge commit instead, use the
-no-ff
option with git merge
.