Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Splitting a hunk with magit

Tags:

emacs

magit

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?

like image 545
deepakg Avatar asked Mar 01 '12 18:03

deepakg


2 Answers

You can set the mark correctly with Ctrl+Space (C-SPC) and magit will only commit the selected portion.

like image 88
Dominik Honnef Avatar answered Nov 13 '22 16:11

Dominik Honnef


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.

like image 61
phils Avatar answered Nov 13 '22 16:11

phils