Function: magit-stash-pop

magit-stash-pop is an autoloaded, interactive and byte-compiled function defined in magit-stash.el.

Signature

(magit-stash-pop STASH)

Documentation

Apply a stash to the working tree, on success remove it from stash list.

When using a Git release before v2.38.0, simply run "git stash pop" or with a prefix argument "git stash pop --index".

When using Git v2.38.0 or later, behave more intelligently:

First try "git stash apply --index", which tries to preserve the index stored in the stash, if any. This may fail because applying the stash could result in conflicts and those have to be stored in the index, making it impossible to also store the stash's index there.

If "git stash" fails, then potentially fall back to using "git apply". If the stash does not touch any unstaged files, then pass
"--3way" to that command. Otherwise ask the user whether to use
that argument or "--reject". Customize magit-no-confirm if you want to fall back to using "--3way", without being prompted.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-stash.el
;;;###autoload
(defun magit-stash-pop (stash)
  "Apply a stash to the working tree, on success remove it from stash list.

When using a Git release before v2.38.0, simply run \"git stash
pop\" or with a prefix argument \"git stash pop --index\".

When using Git v2.38.0 or later, behave more intelligently:

First try \"git stash apply --index\", which tries to preserve the
index stored in the stash, if any.  This may fail because applying
the stash could result in conflicts and those have to be stored in
the index, making it impossible to also store the stash's index
there.

If \"git stash\" fails, then potentially fall back to using \"git
apply\".  If the stash does not touch any unstaged files, then pass
\"--3way\" to that command.  Otherwise ask the user whether to use
that argument or \"--reject\".  Customize `magit-no-confirm' if you
want to fall back to using \"--3way\", without being prompted."
  (interactive (list (magit-read-stash "Pop stash")))
  (magit-stash--apply "pop" stash))