Skip to content
Latchkey

git stash apply: Usage, Options & Common CI Errors

git stash apply reapplies a stash entry but leaves it on the stack for reuse.

Apply is the safe sibling of pop: because it does not drop the entry, you can retry if the apply goes wrong or reuse the same stash across multiple working trees.

What it does

git stash apply restores the changes from a stash entry onto the working tree without removing the entry, so the same stash can be applied again or dropped later by hand.

Common usage

Terminal
git stash apply
git stash apply stash@{1}
git stash apply --index         # also reinstate the staged set
# apply, verify, then clean up:
git stash apply && make test && git stash drop

Options

FlagWhat it does
[<stash>]Apply a specific entry (default: latest)
--indexTry to restore the index state as well
-q / --quietSuppress informational output

Common errors in CI

error: Your local changes to the following files would be overwritten by merge - the working tree conflicts with the stash; commit or stash current work first. With --index, "Could not restore untracked files from stash" appears when the index state cannot be cleanly reproduced.

Related guides

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