Function: magit-reverse
magit-reverse is an interactive and byte-compiled function defined in
magit-apply.el.
Signature
(magit-reverse &rest ARGS)
Documentation
Reverse the change at point in the working tree.
With a prefix argument fallback to a 3-way merge. Doing so causes the change to be applied to the index as well.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-apply.el
;;;; Reverse
(defun magit-reverse (&rest args)
"Reverse the change at point in the working tree.
With a prefix argument fallback to a 3-way merge. Doing
so causes the change to be applied to the index as well."
(interactive (and current-prefix-arg (list "--3way")))
(when$ (magit-apply--get-selection)
(pcase (list (magit-diff-type) (magit-diff-scope))
(`(untracked ,_) (user-error "Cannot reverse untracked changes"))
(`(unstaged ,_) (user-error "Cannot reverse unstaged changes"))
(`(,_ region) (magit-reverse-region $ args))
(`(,_ hunk) (magit-reverse-hunk $ args))
(`(,_ hunks) (magit-reverse-hunks $ args))
(`(,_ file) (magit-reverse-file $ args))
(`(,_ files) (magit-reverse-files $ args))
(`(,_ list) (magit-reverse-files $ args)))))