git log
Show commit history — uses less pager (f=next, b=prev, q=quit, /=search)
log
git log --oneline
Compact log — one commit per line
log
git log --oneline --graph --decorate
Compact log with ASCII branch graph — excellent for visualising branch structure
graph
git log --no-pager
Show log without the pager — outputs everything at once
log
git log --since=<time>
Show commits since a given time (e.g. 2.weeks, 2024-01-01)
filter
git log -p <file_name>
Show change history for a specific file — diffs included
filter
git log <Branch1> ^<Branch2>
Show commits in Branch1 that are NOT in Branch2
compare
git log -n <x> --oneline
Show the last x commits, one per line
log
git log --grep='<string/regex>'
Search commit messages by string or regex
search
git grep --heading --line-number '<string/regex>'
Search for a string/regex pattern inside tracked files — shows file and line number
search
git diff
Show unstaged changes between working directory and last commit
diff
git diff HEAD
Show all changes in working directory vs last commit (staged + unstaged)
diff
git diff --staged HEAD
Show staged changes vs last commit
diff
git diff --staged
Show only staged changes ready for commit
diff
git reflog
Show when branch tips and references were updated — a safety net for recovering lost commits
reflog
git ls-files
Show all tracked files in the index and working tree
info
git show
Show the most recent commit — blobs, trees, tags and commit objects
info