Cheat Sheets · Git Cheat Sheet · Git Show Commit — Inspect Changes in a Commit
Git Show Commit — Inspect Changes in a Commit
git show <sha>Full commit metadata and unified diff of all changed files
git show --stat <sha>Summary list of changed files with inserted/deleted line counts
git show <sha>:<file-path>View the entire file content as it existed at that commit
git show <sha> -- <file-path>Show diff only for that specific file in the commit
Git show patterns
| Command | What it displays |
|---|---|
git show <sha> | Full commit metadata and unified diff of all changed files |
git show --stat <sha> | Summary list of changed files with inserted/deleted line counts |
git show <sha>:<file-path> | View the entire file content as it existed at that commit |
git show <sha> -- <file-path> | Show diff only for that specific file in the commit |
git show displays the author, date, commit message, and full patch diff for any commit hash, tag, or branch head.
Related Git recipes
Undo Last Commit — 3 Safe Ways
Discard Local Changes — Safely and Completely
Delete a Branch — Local and Remote
Stash — Park Changes Without Committing
Amend the Last Commit
Undo a Pushed Commit — The Safe Way (git revert)
Rename Local Branch — Safely & Quickly
Rename Remote Branch — Complete 3-Step Process
Cherry Pick — Apply a Specific Commit Elsewhere
Squash Last N Commits — Combine Multiple Commits
Sync Fork with Upstream — Step-by-Step
Delete Remote Tag — Local and Remote
Change Commit Author — Email & Name
Unstage File — Remove from Staging Area
Log Graph — Visual Commit History in Terminal
Clean Untracked Files — Remove Clutter Safely
Switch Branch — Modern Branch Navigation
Create Branch from Commit — Branch Off History
Stash Untracked Files (-u and -a Flags)
Force Pull — Overwrite Local Changes with Remote
Resolve Merge Conflict — Complete Workflow
Tag a Release — Lightweight & Annotated Tags
FAQ
How do I view the diff of the latest commit?
Run git show HEAD (or just git show).
How to view the parent of a commit?
Use git show .
Can I see just the commit message without the diff?
Yes: git show -s (--no-patch).
Stop memorizing — build it interactively
Try git show in the Git BuilderFull reference: Git Cheat Sheet