- Developers who already know basic commit and branch actions
- Readers who want to understand command boundaries and risk
Command Reference
git show
Inspect a specific commit, tag, or object in detail, making it one of the most useful commands for reading history precisely.
- A basic mental model of worktree, index, and commits
- Comfort reading `git status` and a small commit graph
- Using local cleanup commands on already shared history
- Continuing to rewrite before confirming a recovery path
Citations & Further Reading
- Git show [Official]
- Git Basics Viewing the Commit History [Book]
What you will learn
- Understand the core purpose of git show
- Master the basic usage and common options of git show
- Inspect a specific commit, tag, or object in detail, making it one of the most useful commands for reading history precisely.
- Understand key concepts: Common uses
- Know when to use this feature and when to avoid it
git show expands a single object into readable detail. Most often that means commit metadata plus diff, but it can also be used with tags and other Git objects.
Start with a problem
You're working in a Git repository and need to perform a specific task — but you're not sure which command or option is the right fit, or what this command can and cannot do.
Common uses
- inspect exactly what one commit changed
- verify what a tag points to
- expand
HEAD,HEAD~1, or a hash into readable information
git show HEAD
git show HEAD~1
git show v1.2.0
git show --stat <commit>
git show --name-only <commit>
Best mental model
Think of git log as “list many commits” and git show as “open one object and read it carefully.”
Useful options
--stat--name-only--name-status--no-patch
Important note
git show is read-only. It is safe to use while debugging, reviewing, and understanding history.
What problem this command solves in a workflow
In the workflow, git show is mostly a “inspect first, decide second” command. It usually does not rewrite history by itself; instead, it helps you confirm the current state of the working tree, index, refs, or commit objects.
Typical use cases
- Use
git showbefore changing files or history so you have observable evidence first. - Put
git showinto review, debugging, and incident-analysis flow so the team can align on the same context. - When you need to explain why the repository looks the way it does, let
git showsurface verifiable information first.
Diagram view
Special cases and boundaries
- Most inspection commands do not mutate history, but their output still depends on which HEAD, path, range, or ref you asked them to inspect.
- If
git showshows something unexpected, first verify whether you are looking at the working tree, the index, the current branch, or a historical commit. - Combining
git showwithgit status,git log, andgit diffis usually safer than trusting a single output in isolation.
Try it yourself
- Practice the git-show command in a test repository and observe state changes before and after
- Experiment with different options and compare the output differences
- Simulate a real scenario where you would need to use this, and walk through the full process
Further reading
Keep going on the same topic: