Commit, tree, tag, blob — show what's inside.
Print one or more objects in a human-readable form. For commits: metadata + diff. For trees: like ls-tree. For tags: the tag plus the commit it points to. For blobs: the file contents.
show is cat-file -p with formatting layered on top. It dispatches on object type. The diff for a commit is diff <parent> <commit> under the hood.
git show [<options>] <object>...| Flag | What it does |
|---|---|
--stat | File-summary instead of full diff. |
--name-only | Just the changed file names. |
--pretty=<format> | Customize the metadata header (oneline, short, medium, full, format:%h %s etc.). |
-s | Suppress the diff. Just show the metadata. |
--word-diff | Word-level diff. |
<rev>:<path>).$ git show$ git show HEAD:src/$ git show v1.2:Makefile$ git show -s --format=%B HEAD~3git show <ref>:<path> is faster to type than git checkout <ref> -- <path> && cat <path> && git restore <path> and doesn't dirty anything.show <sha> is the cleanest answer.show defaults to a 'combined diff' — not the diff against either parent. Add -m to see per-parent diffs.show of a tag shows the tag object, not the commit it points to, unless you dereference (tag^{commit}).Hit each option, then Check answers. Score is recorded; Next is always open.