# git show: Usage, Options & Common CI Errors

> git show displays a commit, tag, or object with its diff. Reference for --stat, --name-only, blob viewing, and the bad-revision errors CI hits.

Source: https://latchkey.dev/learn/command-reference/git-show  
Updated: 2026-06-25

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.

## Using this in CI

CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.

```.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0   # history, tags, and git describe all need this

- run: |
    git rev-parse --is-shallow-repository   # expect false
    git rev-parse --abbrev-ref HEAD          # prints HEAD when detached
```

> `git rev-parse --abbrev-ref HEAD` returns the literal string `HEAD` on a detached checkout rather than a branch name. On GitHub Actions read `github.ref_name` instead; the git command cannot know what it was checked out for.

## FAQ

### git show: Usage, Options & Common CI Errors?

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 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.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
