Function: magit-branch-unshelve

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

Signature

(magit-branch-unshelve BRANCH)

Documentation

Unshelve a BRANCH.

Rename "refs/shelved/BRANCH" to "refs/heads/BRANCH". If BRANCH is prefixed with "YYYY-MM-DD", then drop that part of the name. Also rename the respective reflog file.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-branch.el
;;;###autoload
(defun magit-branch-unshelve (branch)
  "Unshelve a BRANCH.
Rename \"refs/shelved/BRANCH\" to \"refs/heads/BRANCH\".  If BRANCH
is prefixed with \"YYYY-MM-DD\", then drop that part of the name.
Also rename the respective reflog file."
  (interactive (list (magit-read-shelved-branch "Unshelve branch")))
  (let ((old (concat "refs/shelved/" branch))
        (new (concat "refs/heads/"
                     (if (string-match-p
                          "\\`[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}-" branch)
                         (substring branch 11)
                       branch))))
    (magit-git "update-ref" new old "")
    (magit--rename-reflog-file old new)
    (magit-run-git "update-ref" "-d" old)))