[Git] Restore and remove a stash with git stash pop

Created on November 30, 2026

Use git stash pop to apply a stash and remove its entry if application succeeds. This example assumes config.txt is tracked and its working copy contains mode=prod.

git stash push -qm 'change mode'
git stash pop --quiet
cat config.txt
mode=prod

-q suppresses normal output. -m 'change mode' names the entry created with git stash push. --quiet also suppresses the normal output from pop.

To select an older entry, pass its name, such as 'stash@{1}'. If application fails because of a conflict, Git keeps the stash.

Reference

Git