Git show Command
In this page:
Showing the Last Commit
git show with no arguments displays everything about your most recent commit -- author, date, full message, and the exact patch (line-by-line code changes) it introduced -- in one combined view.
Example: Showing the Last Commit
git show
Showing a Specific Commit
Passing a specific commit hash or tag name, like git show a1b2c3d, lets you inspect any point in your project's history the same way, not just the latest commit.
Example: Showing a Specific Commit
git show a1b2c3d
Showing a File at a Specific Commit
git show <commit>:<path/to/file> prints a file's exact contents as they existed at that specific commit, without checking out that commit or disturbing your current branch or working files at all.
Example: Showing a File at a Specific Commit
git show a1b2c3d:path/to/file.txt
Customizing the Output Format
If you only care about which files changed rather than the full line-by-line patch, git show --stat swaps the detailed diff for a compact summary of insertion/deletion counts per file.
Example: Customizing the Output Format
git show --stat
Showing File Names and Status
git show --name-only goes even further, listing just the filenames that were added, modified, or deleted in that commit -- useful for a quick glance at a commit's scope before diving into the actual changes.
Example: Showing File Names and Status
git show --name-only
Chapter Quiz — Complete all 18 topics to unlock
0/18 topics done
Complete these topics first:
- Git init Command
- Git New Files
- Git Staging Environment
- Git clone Command
- Git status Command
- Git help Command
- Git add Command
- Git commit Command
- Git tags Command
- Git stash Command
- Git log Command
- Git diff Command
- Git show Command
- Git rm Command
- Git mv Command
- Git restore Command
- Git clean Command
- Git ignore (.gitignore)