I have 2 edits very close by (and therefore part of the same hunk), that I'd like to commit separately. Is it possible to split a hunk from within magit?
Dominik Honnef
You can set the mark correctly with Ctrl+Space (C-SPC) and magit will only commit the selected portion.
You can also use - and + to decrease or increase the extent of the hunks in the diff (and 0 resets), but dominikh's answer is the most important one to know about.
Magit reuse diff-mode but don't expose many of diff-mode commands in its magit-revision-mode as this does VC package.
For example you can call diff-split-hunk which is usually C-c C-s in diff-mode.
来源:https://stackoverflow.com/questions/9521929/splitting-a-hunk-with-magit