Function: magit-branch-shelve

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

Signature

(magit-branch-shelve BRANCH)

Documentation

Shelve a BRANCH.

Rename "refs/heads/BRANCH" to "refs/shelved/YYYY-MM-DD-BRANCH", and 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-shelve (branch)
  "Shelve a BRANCH.
Rename \"refs/heads/BRANCH\" to \"refs/shelved/YYYY-MM-DD-BRANCH\",
and also rename the respective reflog file."
  (interactive (list (magit-read-other-local-branch "Shelve branch")))
  (let ((old (concat "refs/heads/" branch))
        (new (format "refs/shelved/%s-%s"
                     (magit-rev-format "%cs" branch)
                     branch)))
    (magit-git "update-ref" new old "")
    (magit--rename-reflog-file old new)
    (magit-branch-unset-pushRemote branch)
    (magit-run-git "branch" "-D" branch)))