Function: magit-reset-internal

magit-reset-internal is a byte-compiled function defined in magit-reset.el.

Signature

(magit-reset-internal ARG COMMIT &optional PATH)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-reset.el
(defun magit-reset-internal (arg commit &optional path)
  (when (and (not (member arg '("--hard" nil)))
             (equal (magit-rev-parse commit)
                    (magit-rev-parse "HEAD~")))
    (with-temp-buffer
      (magit-git-insert "show" "-s" "--format=%B" "HEAD")
      (when git-commit-major-mode
        (funcall git-commit-major-mode))
      (git-commit-setup-font-lock)
      (git-commit-save-message)))
  (let ((cmd (if (and (equal commit "HEAD") (not arg)) "unstage" "reset")))
    (magit-run-before-change-functions nil cmd)
    (magit-run-git "reset" arg commit "--" path)
    (when (equal cmd "unstage")
      (magit-run-after-apply-functions nil "unstage"))))