Skip to content
Latchkey

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

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

FlagWhat it does
--statShow 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.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →