Function: magit-reset-worktree

magit-reset-worktree is an autoloaded, interactive and byte-compiled function defined in magit-reset.el.

Signature

(magit-reset-worktree COMMIT)

Documentation

Reset the worktree to COMMIT.

Keep the HEAD and index as-is.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-reset.el
;;;###autoload
(defun magit-reset-worktree (commit)
  "Reset the worktree to COMMIT.
Keep the `HEAD' and index as-is."
  (interactive (list (magit-read-branch-or-commit "Reset worktree to")))
  (magit-run-before-change-functions nil "reset")
  (magit-with-temp-index commit nil
    (magit-call-git "checkout-index" "--all" "--force"))
  (magit-run-after-apply-functions nil "reset")
  (magit-refresh))