47. 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
49. What is a merge?
merges keep the context of
the featureâs commits
M
Merge commit
feature
master
feature
master
50. 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
51. merge is better in git
git knows the ancestry
1
2
The merge is local
3 powerful merge strategies
52. Letâs talk about merge strategies!
git has breadth of choice on
how to merge changes!
resolve recursive octopus
ours subtree yours?
53. What is a fast-forward merge?
It will just shift the HEAD tag
master
feature
master
feature
54. merge strategy: resolve
Three-way merge of the ancestors
feature
Common ancestor
master M
Merge commit
55. 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
56. merge strategy: ours
Records a merge but skips incoming changes
feature
master M
IGNORE!
60. What is a rebase?
Itâs a way to replay commits,
one by one, on top of a branch
master
feature
61. When you use mergeâŠ
You pollute your feature branch with
non-meaningful merge commits
not really part
of featureâŠ
feature
master
meaningful
merge
62. What is a rebase?
It can be used to keep a feature
branch up to date with master
feature
master
63. What is an
--interactive rebase?
Helps you clean up your private
branches before publishing them
reword
fixup
pick
squash
edit
exec
64. CUSTOMARY
WARNING!
rebase rewrites history!
Treat this power with great care. Only
rewrite history of local branches orâŠ
66. 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
77. 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 ?