When in a magit diff view, pressing enter in a blob 'visit' the file. But this file is a special read only version.

The magit manual mentions a way to visit the (actual writable) file:

C-<return>     (magit-diff-visit-file-worktree)
source: https://magit.vc/manual/magit/Visiting-Files-and-Blobs-from-a-Diff.html

This combo doesn't work, and M-x doesn't even mention a magit-diff-visit-file-worktree

What am I doing wrong?

My system:
GNU Emacs 26.2 (build 1, x86_64-apple-darwin18.5.0) of 2019-04-13
-UUU:@%%--F7  magit-diff: web-app   Top L1     (Magit Diff yas Rails Projectile WK) ----
macOS 10.15.3
  • Is it possible your magit package needs updating? Does the built-in Info manual for Magit mention that command? C-h i m magit RET should get you there.
    – rpluim
    Apr 24, 2020 at 14:35
  • You could try C-j which is magit-diff-visit-worktree-file.
    – caisah
    Apr 24, 2020 at 18:59

1 Answer 1


I think you are simply using an older version of Magit. Using this commit d05545ec2fd7edf915eaf1b9c15c785bb08975cc, it works for me (I'm managing my Emacs packages using GNU Guix. MELPA also tracks the latest Magit commit.

Something I find useful to diagnose which function is mapped to a certain key stroke is C-h k <key strokes>. In the present case, C-h k C-<RET> when looking at a hunk in magit-diff should display something like:

<C-return> runs the command magit-diff-visit-worktree-file (found in
magit-hunk-section-map), which is an interactive compiled Lisp
function in

It is bound to <C-return>, C-j.

(magit-diff-visit-worktree-file FILE &optional OTHER-WINDOW)

From a diff visit the worktree version of FILE.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.