What is git show?
git show is used to display detailed information about a Git object, most commonly a commit. It shows the commit message, author, date, and the actual changes (diff) introduced in that commit.
If you simply run:
git showGit will display details of the latest commit (HEAD).
👉 In simple terms:
git show = “show me what changed in this commit”
Why and When You Should Use git show
If you are already using Git, you might be using commands like:
git log→ to see commit historygit diff→ to compare changes
But these do not give a complete picture in one place.
👉 That’s where git show helps.
Use git show when you want:
- Full details of a commit (message + changes together)
- To quickly inspect what a commit actually did
- To debug issues by checking exact changes
- To review code before merging or deployment
git show vs git log vs git diff
| Command | What it does |
|---|---|
| git show | Shows commit details + changes (all in one) |
| git log | Shows commit history only |
| git diff | Shows changes between commits or files |
👉 If you want everything in one command → use git show
Git Show Command – Quick Cheat Sheet
| Description | Command |
|---|---|
| Show latest commit | git show |
| Show latest commit using HEAD | git show HEAD |
| Show specific commit details | git show <commit-hash> |
| Show commit in one line | git show --oneline |
| Show only commit message | git show -s |
| Show only diff (changes) | git show --patch |
| Show diff summary (files changed) | git show --stat |
| Show changes without diff content | git show --name-only |
| Show file names with status | git show --name-status |
| Show specific file from commit | git show <commit>:<file> |
| Show content of file in last commit | git show HEAD:<file> |
| Compare file across commits | git show <commit>:<file> |
| Show tag details | git show <tag-name> |
| Show commit with short hash | git show --abbrev-commit |
| Show full commit hash | git show --no-abbrev-commit |
| Show raw commit data | git show --raw |
| Show output in email format | git show --pretty=email |
| Show detailed author info | git show --pretty=fuller |
| Show only commit metadata | git show --no-patch |
| Show multiple commits | git show <commit1> <commit2> |
| Show stash changes | git stash show -p |
| Show object (blob/tree/tag) | git show <object-id> |
| Show changes for last commit only | git show HEAD~1 |
| Show commit with color diff | git show --color |
| Show minimal output for scripts | git show --pretty=format:"%h %s" |
Quick Examples
# Show latest commit
git show
# Show specific commit
git show 1a2b3c4d
# Show file from a commit
git show 1a2b3c4d:index.html
# Show only summary
git show --stat
# Show only commit message
git show -sView Commit Details
Show latest commit (git show HEAD)
To view the latest commit details, including message and changes:
git show HEADThis is useful when reviewing recent work after making changes using git commit message.
Show specific commit (git show )
To inspect a particular commit:
git show <commit-hash>You can find commit hashes using git log or explore history with
git reflog tutorial.
Show commit summary only
If you only want a quick summary without full diff:
git show --onelineThis gives a concise view similar to commit listings from git list branches.
View Changes in a Commit
Show full diff of a commit
To see complete changes introduced in a commit:
git show <commit-hash>This combines commit details and diff output, unlike git diff examples which only shows differences.
Show only file changes
To list only files changed in a commit:
git show --name-onlyUseful when reviewing modifications after operations like git merge examples.
Show diff stats (insertions/deletions)
To get a summary of changes:
git show --statThis helps analyze impact before applying changes or during code review workflows.
View File Content from a Commit
Show a specific file from commit
To view a file from a past commit:
git show <commit-hash>:<file>This is helpful when restoring content or comparing with current state using git restore.
Compare file across commits
To inspect how a file changed over time:
git show <commit-hash>:<file>For deeper comparison across commits, you can also use git diff examples.
Work with Tags and Objects
Show tag details
To view information about a tag, including the associated commit:
git show <tag-name>This displays tag metadata, message, and commit details. To learn more about tags, refer to git tag tutorial.
Show Git objects (blob, tree)
You can also inspect low-level Git objects like blobs and trees:
git show <object-id>For deeper inspection of Git internals, you can compare this with plumbing commands like git cat-file.
Difference between git show and git cat-file
git show→ human-readable output (commit, diff, message)git cat-file→ raw object-level inspection
👉 Use git show for daily workflows and git cat-file for debugging internals.
Customize git show Output (Advanced but High Value)
Use --pretty formats (oneline, full, email)
Customize how commit details are displayed:
git show --pretty=oneline
git show --pretty=full
git show --pretty=emailThis helps when formatting logs or reviewing commits.
Show short vs full commit hash
Control how commit hashes are displayed:
git show --abbrev-commit
git show --no-abbrev-commitThis is useful when working with commit history and referencing commits precisely.
Show raw output and patches
To inspect low-level or patch-style output:
git show --raw
git show --patchUseful for debugging or understanding detailed changes, especially when comparing with tools like git diff examples.
Common Errors and Confusions
git show not working or empty output
This usually happens when:
- No commits exist yet
- Incorrect reference is used
Fix by verifying commit history:
git loginvalid commit hash
Occurs when the commit ID is incorrect or incomplete.
Fix:
- Use
git log --onelineto get valid commit IDs - Copy the correct hash before running
git show
difference between git show and git diff
git show→ displays commit details + changesgit diff→ compares changes between commits or working directory
Use git show for inspecting a commit and
git diff examples for comparison workflows.
Frequently Asked Questions
1. What does git show do?
The git show command displays detailed information about a commit, including the commit message, author, date, and the changes introduced in that commit.2. How do I view a specific commit in Git?
You can view a specific commit usinggit show <commit-hash>, which displays commit details and the associated changes.3. What is the difference between git show and git diff?
Git show displays commit details along with changes, while git diff is used to compare differences between commits or files.4. How do I view a file from a previous commit?
You can view a file from a commit usinggit show <commit-hash>:<file>, which shows the file content at that point in history.5. Can git show display tags and objects?
Yes, git show can display information about tags, blobs, trees, and other Git objects using their identifiers.Summary
The git show command is one of the most useful tools for inspecting commits, files, and Git objects in a single step.
In this guide, you learned how to:
- View commit details and changes
- Inspect specific files from commits
- Work with tags and Git objects
- Customize output for different use cases
- Troubleshoot common issues
Using git show effectively helps in debugging, reviewing code, and understanding changes quickly without switching between multiple Git commands.
Official Documentation
For more details, refer to the official Git documentation:



![Git Error: Cannot Delete Branch Checked Out or Used by Worktree [SOLVED]](/cannot-delete-branch-checked-out-at/git-cannot-delete-branch_hu_3f86bd25a59d627d.webp)






