Splitting a hunk with magit

妖精的绣舞 提交于 2019-11-27 19:51:46

问题


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?


回答1:


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




回答2:


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.




回答3:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!