Function: magit-wip-purge

magit-wip-purge is an interactive and byte-compiled function defined in magit-wip.el.

Signature

(magit-wip-purge)

Documentation

Ask to delete all wip-refs that no longer have a corresponding ref.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-wip.el
(defun magit-wip-purge ()
  "Ask to delete all wip-refs that no longer have a corresponding ref."
  (interactive)
  (cond-let
    ([wiprefs (thread-last
                (cl-set-difference (magit-list-refs "refs/wip/")
                                   (magit-list-refs)
                                   :test (##equal (substring %1 15) %2))
                (delete "refs/wip/index/HEAD")
                (delete "refs/wip/wtree/HEAD"))]
     (magit-confirm 'purge-dangling-wiprefs
       "Delete wip-ref %s without corresponding ref"
       "Delete %d wip-refs without corresponding ref"
       nil wiprefs)
     (message "Deleting wip-refs...")
     (dolist (wipref wiprefs)
       (magit-call-git "update-ref" "-d" wipref))
     (message "Deleting wip-refs...done")
     (magit-refresh))
    ((message "All wip-refs have a corresponding ref"))))