试图通过git add -p和split选项将一个大块分成较小的一个,但是整个文件看起来像一个大块而且我不能拆分它.
git help add 说我应该拆分,我记得使用它,但在我当前的例子中,该选项没有出现在提示中.Git版本:1.9.1.Xubuntu 14,哦-my-zsh.大块头不是一行,而是多行.任何想法为什么会这样?
编辑了更多数据,这里是控制台日志:
+last line of long text
Stage this hunk [y,n,q,a,d,/,e,?]? s
y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk nor any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk nor any of the later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
? - print help
Run Code Online (Sandbox Code Playgroud)
为什么在 中缺少拆分选项
git add -p?
您不必在 Git 2.17(2018 年第二季度)中问这个问题,因为现在仅针对已启用的键提供单键帮助(例如,/当只有一个大块时,不会显示“ ” 的帮助) .
请参阅Phillip Wood ( ) 的提交 4bdd6e7、提交 88f6ffc、提交 01a6966(2018 年 2 月 13 日)。(由Junio C Hamano合并-- --在60f8b89 提交中,2018 年 3 月 6 日)phillipwood
gitster
第一的:
add -p: 改进错误信息如果用户按下当前未激活的键,则解释其未激活的原因,而不是仅列出所有键。它已经对某些键执行了此操作,此补丁对尚未处理的那些键执行相同的操作。
和:
add -p: 只显示活动键的帮助如果用户按下了一个
add -p不期望的键,那么它会打印一个键绑定列表。
尽管提示仅列出活动绑定,但已为所有绑定打印帮助。通过使用提示中的键列表过滤帮助来解决此问题。
请注意,help_patch_cmd()调用方已将密钥列表传递给了调用方,因此无需对调用站点进行更改。