Smokin' git rebase - David Golden · Smokin' git rebase David Golden Staff Engineer, MongoDB DCBPW...
Transcript of Smokin' git rebase - David Golden · Smokin' git rebase David Golden Staff Engineer, MongoDB DCBPW...
Smokin' git rebase
David GoldenStaff Engineer, MongoDB
DCBPW • April 2016
Peter Rabbitson, aka ‘ribasushi’
masterfailing test Atest A passingtopic1
masterfailing test Atest A passingfailing test Btest B passingtopic1
masterfailing test Atest A passingfailing test Btest B passingwip 1wip 2wip 3wip 4topic1
master
topic1
failing test Atest A passingfailing test Btest B passing
wip 3awip 3btopic2X
wip 1wip 2wip 3wip 4
masterfailing test Atest A passingfailing test Btest B passing
Xwip 3cwip 3dtopic2
wip 3awip 3b
wip 1wip 2wip 3wip 4topic1
masterfailing test Atest A passingfailing test Btest B passingwip 1wip 2wip 3wip 4
topic2
Xtopic3
XXX
wip 3cwip 3d
wip 3awip 3b
topic1 wip 3a1wip 3a2✓
masterfailing test Atest A passingfailing test Btest B passingwip 1wip 2wip 3
topic3
wip 3awip 3a1wip 3a2✓
masterfailing test Atest A passingfailing test Btest B passingwip 1wip 2wip 3wip 3a
topic3wip 3a1wip 3a2✓
Merge this? No!
masterfailing test Atest A passingfailing test Btest B passingwip 1wip 2wip 3wip 3a
topic3wip 3a1wip 3a2
TESTSBROKEN
masterfailing test Atest A passingfailing test Btest B passingwip 1wip 2wip 3wip 3a
topic3wip 3a1wip 3a2
TOO GRANULAR
Rebase!
masterfailing test Atest A passingfailing test Btest B passingwip 1wip 2wip 3wip 3a
topic3wip 3a1wip 3a2
masterfeature Afeature Bwip 1wip 2wip 3wip 3awip 3a1wip 3a2 topic3-rebase
masterfeature Afeature Bstuff 1stuff 2stuff 3stuff 4 topic3-rebase
But will it pass tests?
masterfeature Afeature B
topic3-rebase
??????
stuff 1stuff 2stuff 3stuff 4
Smokin' git rebase
smoke-rebase () { while true; do ( perl Makefile.PL && \ make realclean && \ perl Makefile.PL && \ ) >&/dev/null \ && make test \ && git rebase --continue \ || break done }
https://tinyurl.com/smoke-rebase
masterfeature Afeature B
topic3-rebase
??????
stuff 1stuff 2stuff 3stuff 4
masterfeature Afeature B
topic3-rebase
?????
stuff 1stuff 2stuff 3stuff 4
masterfeature Afeature B
topic3-rebase
?????
stuff 1stuff 2stuff 3stuff 4
masterfeature Afeature B
topic3-rebase
????
stuff 1stuff 2stuff 3stuff 4
masterfeature Afeature B
topic3-rebase
????
stuff 1stuff 2stuff 3stuff 4
masterfeature Afeature B
topic3-rebase
???
stuff 1stuff 2stuff 3stuff 4
masterfeature Afeature B
topic3-rebase
???
stuff 1stuff 2stuff 3stuff 4
masterfeature Afeature B
topic3-rebase
??
stuff 1stuff 2stuff 3stuff 4
masterfeature Afeature B
topic3-rebase
??
stuff 1stuff 2stuff 3stuff 4
Fix it!
(e.g. git commit --amend)
masterfeature Afeature B
topic3-rebase
???
stuff 1stuff 2'stuff 3stuff 4
Start smoking again!
masterfeature Afeature B
topic3-rebase
??
stuff 1stuff 2'stuff 3stuff 4
masterfeature Afeature B
topic3-rebase
??
stuff 1stuff 2'stuff 3stuff 4
masterfeature Afeature B
topic3-rebase ?
stuff 1stuff 2'stuff 3stuff 4
masterfeature Afeature B
topic3-rebase ?
stuff 1stuff 2'stuff 3stuff 4
masterfeature Afeature B
topic3-rebase
stuff 1stuff 2'stuff 3stuff 4
masterfeature Afeature B
topic3-rebase
stuff 1stuff 2'stuff 3stuff 4✓
✓Ready to merge!