git stash list: Usage, Options & Common CI Errors
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
git stash list
git stash list --stat
git stash list --format='%gd: %s'
git stash show -p stash@{0} # full diff of one entryOptions
| 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.