Function: magit-stash-branch-here

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

Signature

(magit-stash-branch-here STASH BRANCH)

Documentation

Create and checkout a new BRANCH from an existing STASH.

Use the current branch or HEAD as the starting-point of BRANCH. Then apply STASH, dropping it if it applies cleanly.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-stash.el
;;;###autoload
(defun magit-stash-branch-here (stash branch)
  "Create and checkout a new BRANCH from an existing STASH.
Use the current branch or `HEAD' as the starting-point of BRANCH.
Then apply STASH, dropping it if it applies cleanly."
  (interactive (list (magit-read-stash "Branch stash")
                     (magit-read-string-ns "Branch name")))
  (let ((start-point (or (magit-get-current-branch) "HEAD")))
    (magit-call-git "checkout" "-b" branch start-point)
    (magit-branch-maybe-adjust-upstream branch start-point))
  (magit-stash-apply stash))