All commands

git show

intermediate

Dump the full anatomy of any single object.

What it does

git show prints a git object in human-readable form. Give it a commit and you get its metadata plus the diff of what it introduced. You can also show tags, trees, or a single file from any revision — all read-only.

commit74d3b9f0…
treef2b0c9d1a4e8…
parent9a2f1c0b7d3e…
authorAda <ada@dev> 12:07 +0200
committerAda <ada@dev> 12:07 +0200
messagefeat: add dark mode
treef2b0c9d1…
blob aa8f1e… README.md
blob 3c2d09… src/main.ts
tree b7e1a2… src/
blobaa8f1e…
header: blob + size
content bytes…
SHA-1 → unique key of content

git show renders a commit object's full anatomy

Watch it — press play

A narrated, step-by-step walkthrough that shows how to do it — not just theory. It adapts to the learner mode you picked in the top bar.

1 / 2

Step 1

Open one commit

git show displays the full anatomy of a single object — for a commit, that's metadata plus its diff.

git show 74d3b9f
commit74d3b9f0…
treef2b0c9d1a4e8…
parent9a2f1c0b7d3e…
authorAda <ada@dev> 12:07 +0200
committerAda <ada@dev> 12:07 +0200
messagefeat: add dark mode
treef2b0c9d1…
blob aa8f1e… README.md
blob 3c2d09… src/main.ts
tree b7e1a2… src/
blobaa8f1e…
header: blob + size
content bytes…
SHA-1 → unique key of content

tree, parent, author, committer, message — then the diff

Under the hood

1

Every object type has a renderer

git show is a dispatcher: it looks at the object type (commit / tree / blob / tag) and picks the matching pretty-printer. Commit → metadata + diff; blob → raw content; tag → tagger + message.

2

Revision:path reads a blob from history

`git show HEAD~2:src/App.tsx` resolves HEAD~2 to a commit, reads its tree, walks to src/, and prints the blob verbatim — the file as it was two commits ago, without touching the working tree.

Aliases the pros type

Memorize the git show concept, then let one of these shortcuts make it instant. Aliases are real git config keys — add one with:

git config --global alias.st # → git show
AliasWhy people use it
g sh

Common single-commit inspector alias.

g sh --stat

What files a commit touched, at a glance.

Command anatomy

git show <rev>[<:path>]
--stat

Just a summary of files changed, not the full diff.

--no-patch

Metadata only — identity, parents, message, nothing else.

<rev>:<path>

Print that exact file's content at that revision.

When to reach for it

Reviewing a single commit in full: `git show 74d3b9f`.

Pulling a file out of history: `git show release/1.0:configs/env.js > env.js`.

Inspecting a tag object to see who tagged and when.

Pro tip

The `rev:path` syntax is a secret file-recovery tool: accidentally deleted a file? `git show HEAD~1:path/to/file.js` brings it back without touching git history at all.

Go deeper with