Skip to content
Latchkey

git stash pop: Usage, Options & Common CI Errors

git stash pop reapplies your most recent stash and drops it from the stack on success.

Pop is apply-then-drop in one step. The subtlety automation must handle: on a conflict, pop reapplies the changes but keeps the stash entry, so the stack is not actually cleaned up.

What it does

git stash pop applies the changes from a stash entry (the latest by default) back onto the working tree, then deletes that entry - but only if the apply succeeds without conflicts.

Common usage

Terminal
git stash pop
git stash pop stash@{2}
git stash pop --index           # also restore the staged/unstaged split
git stash list                  # confirm the stack

Options

FlagWhat it does
[<stash>]Pop a specific entry (default: stash@{0})
--indexRestore index state too, not just the worktree
-q / --quietSuppress output

Common errors in CI

On conflict, pop prints "The stash entry is kept in case you need it again" and exits non-zero - the entry stays on the stack. Resolve, git add, then git stash drop manually. "No stash entries found" also exits non-zero; guard pop in scripts that may run with an empty stack.

Related guides

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