Function: magit-stash-apply
magit-stash-apply is an autoloaded, interactive and byte-compiled
function defined in magit-stash.el.
Signature
(magit-stash-apply STASH)
Documentation
Apply a stash to the working tree.
When using a Git release before v2.38.0, simply run "git stash apply" or with a prefix argument "git stash apply --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-apply (stash)
"Apply a stash to the working tree.
When using a Git release before v2.38.0, simply run \"git stash
apply\" or with a prefix argument \"git stash apply --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 "Apply stash")))
(magit-stash--apply "apply" stash))