Function: magit-diff-edit-hunk-commit
magit-diff-edit-hunk-commit is an autoloaded, interactive and
byte-compiled function defined in magit-extras.el.
Signature
(magit-diff-edit-hunk-commit)
Documentation
From a hunk, edit the respective commit and visit the file.
First visit the file being modified by the hunk at the correct
location using magit-diff-visit-file. This actually visits a
blob. When point is on a diff header, not within an individual
hunk, then this visits the blob the first hunk is about.
Then invoke magit-edit-line-commit, which uses an interactive
rebase to make the commit editable, or if that is not possible
because the commit is not reachable from HEAD by checking out
that commit directly. This also causes the actual worktree file
to be visited.
Neither the blob nor the file buffer are killed when finishing
the rebase. If that is undesirable, then it might be better to
use magit-rebase-edit-commit instead of this command.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-extras.el
;;;###autoload
(defun magit-diff-edit-hunk-commit ()
"From a hunk, edit the respective commit and visit the file.
First visit the file being modified by the hunk at the correct
location using `magit-diff-visit-file'. This actually visits a
blob. When point is on a diff header, not within an individual
hunk, then this visits the blob the first hunk is about.
Then invoke `magit-edit-line-commit', which uses an interactive
rebase to make the commit editable, or if that is not possible
because the commit is not reachable from `HEAD' by checking out
that commit directly. This also causes the actual worktree file
to be visited.
Neither the blob nor the file buffer are killed when finishing
the rebase. If that is undesirable, then it might be better to
use `magit-rebase-edit-commit' instead of this command."
(interactive)
(let ((magit-diff-visit-previous-blob nil))
(with-current-buffer
(magit-diff-visit-file--internal nil #'pop-to-buffer-same-window)
(magit-edit-line-commit))))