Here's a preview from my zine, Oh Shit! Git!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
In git you always have some commit checked out. HEAD
is a pointer to that commit and you’ll see HEAD
used a lot in this zine. Like a branch, HEAD
is just a text file. Run cat .git/HEAD
or git status
to see the current HEAD
.
Examples of how to use HEAD:
- show the diff for the current commit:
git show HEAD
UNDO UNDO UNDO UNDO: reset branch to 16 commits ago
git reset --hard HEAD~16
(HEAD~16
means 16 commits ago)show what’s changed since 6 commits ago:
git diff HEAD~6
squash a bunch of commits together
git rebase -i HEAD~8
(this opens an editor, use “fixup” to squash commits together)
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!