Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
Undo, Redo Change History with Git
Slide 2
Slide 2 text
Joshua Wehner • @jaw6 •
[email protected]
• Minneapolis, MN, USA • GitHub Training
Slide 3
Slide 3 text
Undo & Redo Scenarios
Slide 4
Slide 4 text
Undo "Public" Change • It's broken • But it's pushed • git revert
Slide 5
Slide 5 text
Tweak Last Commit • Oooops • Committed too fast • git commit --amend
Slide 6
Slide 6 text
Regrets, I've Had a Few • Ooooops • That's mostly rubbish • git reset
Slide 7
Slide 7 text
Throw It All Away • It's all rubbish • I regret everything • git reset --hard
Slide 8
Slide 8 text
Wait, On Second Thought • Throw It All Away • Could I maybe get that back? • git reflog git reset --hard
Slide 9
Slide 9 text
Well, That Wasn't So Bad • Most of that is trash • But that one? That one is good. • Gimme. • git cherry-pick
Slide 10
Slide 10 text
Put That Thing Over There • I should have made this branch earlier • Those commits should not be on master • git rebase master
Slide 11
Slide 11 text
No content
Slide 12
Slide 12 text
No content
Slide 13
Slide 13 text
Well, Then Again • Throw It All Some of It Away • I regret that one thing • Some of the rest of it was okay • git rebase -i
Slide 14
Slide 14 text
I Was Wrong Before • I thought I was wrong • But I wasn't • git commit --fixup git rebase -i --autosquash
Slide 15
Slide 15 text
Forget I Said That • Stop tracking this file • I mean it • git rm --cached .gitignore git clean -f (also -x maybe?)
Slide 16
Slide 16 text
Thank you! Undo, Redo, Change History • @jaw6 •
[email protected]
• http://training.github.com/
Slide 17
Slide 17 text
I'm Only (Sort of) Kidding • Commit part (just part) of a file • git add -p