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!
Suppose you’ve edited 2 files
$ git status
On branch main
Changes to be committed:
modified: staged.txt
Changes not staged for commit:
modified: unstaged.txt
(”modified: staged.txt
” are staged changes added with git add
. modified: unstaged.txt
are unstaged changes.)
Here are the 3 ways git can show you a diff for these changes:
- git diff
: unstaged changes
- git diff --staged
: staged changes
- git diff HEAD
: staged+unstaged changes
A couple more diff tricks:
- git diff --stat
gives you a summary of which files were changed & number of added/deleted lines
- git diff --check
checks for merge conflict markers & whitespace errors
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!