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!
Every commit (except the first one!) has a parent commit! You can think of your git history as looking like this:
current commit - c6045c - HEAD
- “make cats blue”
parent - 304db6 - HEAD^
- “add cats”
grandparent - a92eab - HEAD^^
- “fix typo”
b29aff - “initial commit”
HEAD
always refers to the current commit you have checked out, and HEAD^
is its parent. So if you want to go look at the code from the previous commit, you can run
git checkout HEAD^
commits don’t always have 1 parent. Merge commits actually have 2 parents!
git log
shows you all the ancestors of the current commit, all the way back to the initial commit
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!