But what if my repo is big?
2 12,000 non-merge commits
446k lines of code added
1
3
Linux Kernel release has 15+ million LOC
4 1,339 contributors
source lwn.net
What is a merge?
merges keep the context of
the feature’s commits
M
Merge commit
feature
master
feature
master
Anatomy of a merge
.git/objects/36/80d8c8fd182f97cb0e75045e2fed5c7b7613ed
tree f362c42032aff677c1a09c3f070454df5b411239
parent 49a906f5722ad446a131778cea52e3fda331b706
parent bd1174cd0f30fe9be9efdd41dcd56256340f230e
author Marcus Bertrand <mbertrand@atlassian.com> 1409002123 -0700
committer Marcus Bertrand <mbertrand@atlassian.com> 1409002123 -0700
Merge branch 'foo/mybranch'
commit
merge is better in git
git knows the ancestry
1
2
The merge is local
3 powerful merge strategies
Let’s talk about merge strategies!
git has breadth of choice on
how to merge changes!
resolve recursive octopus
ours subtree yours?
What is a fast-forward merge?
It will just shift the HEAD tag
master
feature
master
feature
merge strategy: resolve
Three-way merge of the ancestors
feature
Common ancestor
master M
Merge commit
merge strategy: recursive
3-way merge but climbs the ancestry tree
recursively if there are multiple ancestors
M
M
master
feature
ancestor 1
ancestor 3
ancestor 2
merge strategy: ours
Records a merge but skips incoming changes
feature
master M
IGNORE!
Merge Commit Rebase (FF) Rebase (Squash)
No merge commits
Verbose history
Easy to read
Can be more difficult
to trace changes
Which should I use?
“Ugly” history
Full traceability
Hard to screw up
mostly
some
Can we still fix a bug for the
upcoming Release ?
Is the code for that
Feature
complete?
How do we do Hotfix
for the current version?
Has everyoneReviewed
the code for this feature ?