Frequently Asked Question
How do I read history with git log, git show, and git diff?
git log walks the commit graph backwards from HEAD, printing each commit's hash,
author, date, and message. The defaults are verbose; a more useful invocation is
git log --oneline --graph --decorate --all, which shows every branch and tag in a
condensed ASCII graph. You can filter by author (--author=), by message
(--grep=), by file (-- path/to/file), or by date range (--since, --until).
Add -p to see each commit's diff alongside its message.
git show <commit> prints one specific commit's metadata plus its diff against its
parent, useful when you want to inspect a hash you saw in a log line. git diff on
its own shows unstaged changes (working tree vs index); git diff --staged shows
staged changes (index vs HEAD); git diff branch1..branch2 shows what is on
branch2 that is not on branch1. Three dots, branch1...branch2, shows changes
since the two branches diverged. Learning these three commands well is the bulk of
learning to read a Git repository.