git show: Usage, Options & Common CI Errors
git show prints one object - usually a commit and its diff - in detail.
Use git show to inspect a single commit, see a file at a past revision, or read a tag message.
What it does
git show displays the metadata and contents of an object. For a commit it shows the log message and the diff; for a tag, the tag message; for a blob, its contents.
Common usage
Terminal
git show <sha>
git show HEAD --stat
git show HEAD:path/to/file # file contents at HEAD
git show v1.2.0 # tag + its commit
git show --name-only <sha>Options
| Flag | What it does |
|---|---|
| --stat | Show a diffstat instead of the full diff |
| --name-only | List changed files only |
| -s / --no-patch | Suppress the diff (metadata only) |
| <rev>:<path> | Show a file as of a revision |
Common errors in CI
fatal: bad revision 'X' or fatal: ambiguous argument 'X': unknown revision - the SHA/ref does not exist (often truncated, or absent in a shallow clone). Verify the ref with git rev-parse, and remember <rev>:<path> needs an exact in-repo path.
Related guides
git log: Usage, Options & Common CI Errorsgit log shows commit history with flexible formatting. Reference for --oneline, --graph, --pretty, ranges, an…
git diff: Usage, Options & Common CI Errorsgit diff shows changes between commits, the index, and the working tree. Reference for --staged, --name-only,…
git cat-file: Usage, Options & Common CI Errorsgit cat-file inspects Git objects - their type, size, and content. Reference for -t, -s, -p, --batch, and the…
git rev-parse: Usage, Options & Common CI Errorsgit rev-parse resolves refs to SHAs and reports repo paths - core CI plumbing. Reference for --short, --abbre…