# git stash list: Usage, Options & Common CI Errors

> git stash list shows the stash stack with log-style formatting. Reference for --format, stash@{n} addressing, and inspecting stashes before pop in CI.

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

git stash list shows every stash entry on the stack, newest first.

Before popping or dropping blindly, list shows what is parked and how each entry is addressed (stash@{0}, stash@{1}, …). It accepts git log formatting for scriptable output.

## What it does

git stash list prints the entries of the stash stack, each labelled stash@{n}, with the branch and message recorded when it was created. Accepts log options for custom formatting.

## Common usage

```Terminal
git stash list
git stash list --stat
git stash list --format='%gd: %s'
git stash show -p stash@{0}      # full diff of one entry
```

## Options

| Flag | What it does |
| --- | --- |
| --stat | Show a diffstat per entry |
| --format=<fmt> | Custom (git log) output format |
| -p (via stash show) | Show the full diff of an entry |
| stash@{n} | Address the nth entry |

## Common errors in CI

list never errors on an empty stack - it simply prints nothing and exits 0, so scripts should treat empty output (not a non-zero code) as "no stashes". The newest entry is stash@{0}; off-by-one addressing is the usual bug when popping a specific index.

## 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 stash list: Usage, Options & Common CI Errors?

Before popping or dropping blindly, list shows what is parked and how each entry is addressed (stash@{0}, stash@{1}, …). It accepts git log formatting for scriptable output.

### What it does?

git stash list prints the entries of the stash stack, each labelled stash@{n}, with the branch and message recorded when it was created. Accepts log options for custom formatting.

### Common errors in CI?

list never errors on an empty stack - it simply prints nothing and exits 0, so scripts should treat empty output (not a non-zero code) as "no stashes". The newest entry is stash@{0}; off-by-one addressing is the usual bug when popping a specific index.

---

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
