Why is split option missing in git add -p?

醉酒当歌 提交于 2019-11-29 05:32:33
Jeff Puckett

The reason it's not working is because your hunk is already as small as git will automatically get it. Split only works when there are non-changed lines separating changed lines close enough that git assumes they belong together.

In order to achieve what you want, you will need to manually edit the patch

Why is split option missing in git add -p?

You won't have to ask this question with Git 2.17 (Q2 2018), since the single-key help is now given only for keys that are enabled (e.g. help for '/' won't be shown when there is only one hunk).

See commit 4bdd6e7, commit 88f6ffc, commit 01a6966 (13 Feb 2018) by Phillip Wood (phillipwood).
(Merged by Junio C Hamano -- gitster -- in commit 60f8b89, 06 Mar 2018)

First:

add -p: improve error messages

If the user presses a key that isn't currently active then explain why it isn't active rather than just listing all the keys. It already did this for some keys, this patch does the same for the those that weren't already handled.

And:

add -p: only display help for active keys

If the user presses a key that add -p wasn't expecting then it prints a list of key bindings.
Although the prompt only lists the active bindings the help was printed for all bindings.

Fix this by using the list of keys in the prompt to filter the help.
Note that the list of keys was already passed to help_patch_cmd() by the caller so there is no change needed to the call site.

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