我有一个正在处理的文件,然后意识到我在工作位置上方的几行中有一个错误。我很快改正了这个错误,并想在完成其余工作之前就将其提交。太好了,这就是git add --patch进入的地方!
除此以外,我只看到一个结合了两个变化的大块头。是否可以手动告诉git我想要两个帅哥?
最佳答案
除了“y”和“n”之外,当它询问您关于大块的问题时,您可以给出的答案之一是“s”,因为“将大块分割成较小的大块”。完整 list :
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 and all the remaining hunks in the file
d - do not stage this hunk nor any of the remaining 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