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!
get the zine!
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 changesgit diff --staged: staged changesgit diff HEAD: staged+unstaged changes
A couple more diff tricks:
git diff --statgives you a summary of which files were changed & number of added/deleted linesgit diff --checkchecks for merge conflict markers & whitespace errors