I picked up a couple of new tricks at Hacker School’s intermediate/advanced Git seminar, led by Peter Bell.
This checks out whatever you had checked out last. Thanks, Nina!
Draw a graph of the commit history:
1 2 3 4 5 6 7 8 9 10
You can alias this with
git config --global alias.plog "log --graph --oneline --all". (Looking at this graph may motivate you to start using
git merge --no-ff.) You can substitute whatever you want for
If you get really screwed up, it’s reflog time! (This is pronounced ref-log, not re-flog as I’d been reading it. On the other hand, as my colleague Alan notes, “You damn well ought to feel penitent if you’re wedged enough to need the reflog.”) Here, we’re using
git reset to undo the last commit. Even though the commit doesn’t appear in
git log anymore, there’s still a references to it in the reflog.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
It turns out that there is a better way to get a commit sha than running
git log and copying and pasting the relevant shas. You can use
1 2 3 4
Then you can inline with backticks!
Now go forth and git in peace.