Variable: magit-diff-visit-prefer-worktree

magit-diff-visit-prefer-worktree is a customizable variable defined in magit-diff.el.

Value

nil

Documentation

Whether magit-diff-visit-file prefers visiting the worktree file.

By default magit-diff-visit-file does not do that. Instead it behaves for staged and unstaged changes as it does for committed changes, by visiting a blob from the old/left or new/right side, depending on whether point is on a removed line or not.

Setting this to nil, causes magit-diff-visit-file to always go to the file in the worktree when invoked from anywhere within a staged or unstaged change.

It is strongly recommended that instead of changing the value of this option, you use the command magit-diff-visit-worktree-file, which was created for that very purpose. See the description of this option in the manual for an explanation.

This variable was added, or its default value changed, in magit version 4.4.0.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-diff.el
;;;; Visit Commands

(defcustom magit-diff-visit-prefer-worktree nil
  "Whether `magit-diff-visit-file' prefers visiting the worktree file.

By default `magit-diff-visit-file' does not do that.  Instead it
behaves for staged and unstaged changes as it does for committed
changes, by visiting a blob from the old/left or new/right side,
depending on whether point is on a removed line or not.

Setting this to nil, causes `magit-diff-visit-file' to always go to
the file in the worktree when invoked from anywhere within a staged
or unstaged change.

It is strongly recommended that instead of changing the value of
this option, you use the command `magit-diff-visit-worktree-file',
which was created for that very purpose.  See the description of
this option in the manual for an explanation."
  :package-version '(magit . "4.4.0")
  :group 'magit-diff
  :type 'boolean)