Inspecting History
git show
View the full details of any Git object
Practical Example
git show HEAD # show details of latest commit git show HEAD~2 # show the commit two before HEAD git show --stat abc1234 # summary of a specific commit
Command Overview & How It Works
Displays the complete content of a Git object — most commonly a commit. For a commit, git show shows the diff (similar to git log -p) plus the commit metadata. For tags, it shows the tag message and the referenced commit. For trees and blobs, it shows directory contents or file contents respectively. By default, git show shows HEAD. Specify any reference: git show main, git show v1.0.0, git show abc1234 (partial hash), or git show HEAD~3 (3 commits before HEAD). Use git show --name-only to show only file names, or git show --stat for a compact summary. This command is invaluable for quickly inspecting a specific commit during code review or debugging without digging through the full log.
Practical Tips
- •Use git show <hash> to inspect a single commit during review instead of scanning the whole log.
- •git show --stat gives a compact summary and --name-only lists just the files that changed.
- •You can show any object — a tag (git show v1.0.0) or a file at a commit (git show HEAD:src/index.ts) — not just commits.