I use the builtin VC package and it's very nice that when I do a diff of changes in the current file then I can revert any hunk in the diff quickly with C-a

But sometimes I don't want to revert the whole hunk, only certain lines and keep other changes in the hunk. Is it possible somehow? Reverting individual lines, instead of the whole hunk?

1 Answer 1

  • Magit can do this by limiting the revert action to the region.

  • With the built-in diff-mode you can get the same kind of effect by splitting the hunk into portions using diff-split-hunk which is bound to C-c C-s by default.

  • 2
    I don't use git, so I can't use magit, but I tried diff-split-hunk and it works well. Thanks!
    – Tom
    Commented Jul 13, 2018 at 12:06

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.