
Here's a preview from my zine, How Git Works! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

read the transcript!
git has a 2-stage commit process
- tell git what you want to stage (
git add
,git rm
,git mv
, etc.) - make the commit with git commit
Diagram showing two boxes, labelled “untracked files” and “unstaged changes”. They converge into a box labelled “stage” via git add
. They then flow into a box labelled “committed”, which has a heart and smiley face beside it, via git commit
.
git uses 3 terms interchangeably for the staging area
- staged (like
--staged
) - cache (like
--cached
) - index (like
--keep-index
)
it’s total chaos but they’re all the same thing
tiny illustration of a sad stick figure with curly hair: why
tip: you can use git add -p
to commit only certain parts of a file
person: I only want to commit my actual changes, not all the random debugging code I put in
gotcha: git diff
only shows unstaged changes
You can use:
git diff HEAD
to see ALL changes you haven’t committed yetgit diff --cached
to see staged changes
gotcha: git commit -a
doesn’t automatically add new files
person: I CONSTANTLY forget to add new files and then get confused about why they didn’t get committed
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!