Seeing What Changed - diff

git diff

git diff shows line-by-line changes. Which changes depends on the flags:

CommandCompares
git diffWorking directory vs staging (unstaged changes)
git diff --stagedStaging vs last commit (what you're about to commit)
git diff HEADWorking dir vs last commit (all uncommitted)
git diff main featureTwo branches
git diff abc123 def456Two commits
git diff --statSummary (files + line counts)
$ git diff --staged
diff --git a/app.py b/app.py
-print('hi')
+print('hello world')
Tip: Always git diff --staged right before committing - it's the last chance to catch a debug line, a secret, or a stray file you didn't mean to include.