You can also:
git reset --patch
(but not with those modes)
Thursday, August 2, 12
Slide 27
Slide 27 text
Bisecting
aka: Finding a commit
that screwed things up.
Thursday, August 2, 12
Slide 28
Slide 28 text
Bisecting
Thursday, August 2, 12
Slide 29
Slide 29 text
Bisecting
7b35b 91296
9680d
2ab1f c6d43
6 Commits - One Bug
We know that 7b35b is good
We know that cfc332 is bad
But we have no idea where the bug was introduced
cfc332
Thursday, August 2, 12
Slide 30
Slide 30 text
Bisecting
7b35b 91296
9680d
2ab1f c6d43
Tell git what is known good and bad
cfc332
good bad
Thursday, August 2, 12
Slide 31
Slide 31 text
Bisecting
7b35b 91296
9680d
2ab1f c6d43 cfc332
good bad
Thursday, August 2, 12
Slide 32
Slide 32 text
Bisecting
7b35b 91296
9680d
2ab1f c6d43 cfc332
good bad
good
Thursday, August 2, 12
Slide 33
Slide 33 text
Bisecting
7b35b 91296
9680d
2ab1f c6d43 cfc332
good bad
good
good
Thursday, August 2, 12
Slide 34
Slide 34 text
Bisecting
7b35b 91296
9680d
2ab1f c6d43 cfc332
good bad
good
good
2ab1f is most likely good because the commit after it is
Thursday, August 2, 12
Slide 35
Slide 35 text
Bisecting
7b35b 91296
9680d
2ab1f c6d43 cfc332
good bad
good
good bad
Thursday, August 2, 12
Slide 36
Slide 36 text
Bisecting
7b35b 91296
9680d
2ab1f c6d43 cfc332
good bad
good
good bad
bad
Thursday, August 2, 12
Slide 37
Slide 37 text
Recovering lost commits
Thursday, August 2, 12
Slide 38
Slide 38 text
git reflog
Thursday, August 2, 12
Slide 39
Slide 39 text
git reflog
Technically shows any action where the tip of a branch
is modified
git reflog --all
shows stashes, bisects, etc.
Thursday, August 2, 12
Slide 40
Slide 40 text
Recovery
Let’s say I reset --hard and wiped out the commit that
changed my LED to pin 10
Use combination of reflog and cherry-pick to get it back
Thursday, August 2, 12
Slide 41
Slide 41 text
Recovery
Found it! 3ecdba3
Thursday, August 2, 12
Slide 42
Slide 42 text
Recovery
Double check that 3ecdba3 is really the commit we want
git diff 3ecdba3^.. 3ecdba3
Shows me the difference between the commit I want
to cherry pick and the commit prior.
Thursday, August 2, 12
Slide 43
Slide 43 text
git cherry-pick
Now cherry pick 3ecdba3 into our working tree
Note: the sha has changed because this commit now has
a different parent than it did when it was recorded into
the reflog
Thursday, August 2, 12
Slide 44
Slide 44 text
Recovery
Checkout the reflog again to see the cherry-pick
Thursday, August 2, 12
Slide 45
Slide 45 text
Interactive Rebasing
Changing the past
one commit at a
time
Thursday, August 2, 12
Slide 46
Slide 46 text
git rebase -i [commit]
Thursday, August 2, 12
Slide 47
Slide 47 text
git rebase -i [commit]
Thursday, August 2, 12
Slide 48
Slide 48 text
git rebase -i [commit]
Thursday, August 2, 12
Slide 49
Slide 49 text
git rebase -i [commit]
Thursday, August 2, 12
Slide 50
Slide 50 text
Interactive rebase
Thursday, August 2, 12
Slide 51
Slide 51 text
git internals
The plumbing and the porcelain
Thursday, August 2, 12
Slide 52
Slide 52 text
git internals
git stores snapshots, not differences
Storing differences is slow and inflexible
CVS/Subversion git
Thursday, August 2, 12
Slide 53
Slide 53 text
git internals
git stores snapshots, not differences
Storing differences is slow and inflexible
CVS/Subversion git
Thursday, August 2, 12
Slide 54
Slide 54 text
git internals
What does a commit look like?
Thursday, August 2, 12
Slide 55
Slide 55 text
git internals
Let’s investigate a repo
Sorry for the bad “investigation” image ;-)
Thursday, August 2, 12
Slide 56
Slide 56 text
Thanks!
Come work with me at OpenSky!
We’re Hiring
Thursday, August 2, 12