Inspecting Your Repo: status, log, and diff
8 min read
git status — Where Are You Right Now?
git status is the most frequently run Git command. It tells you which files are untracked, modified, or staged, and which branch you are on.
bash
git status
git status -s # short format: one line per filegit log — Browse History
bash
git log # full history
git log --oneline # compact: one commit per line
git log --oneline --graph --all # visual branch graph
git log --author="Jane" # filter by author
git log -- src/auth.ts # history for one filegit diff — See What Changed
bash
git diff # unstaged changes vs last commit
git diff --staged # staged changes vs last commit
git diff main..feature # differences between two branches
git diff abc123 def456 # differences between two commitsRun git diff --staged before every git commit to do a final review of exactly what you are about to commit.
Ready to test yourself?
Practice Git & GitHub— quiz & coding exercises