我可以修改git-add的大小吗?

pr1*_*001 27 git patch add

我有一个文件,我一直在努力,然后意识到我在我工作的几行上面有一个错误.我很快就修正了这个错误,并且在我完成剩下的工作之前想要提交它.太好了,这就是git add --patch的用武之地!

除此之外,我只会看到一个包含两个变化的大块头.是否有可能手动告诉git我想要两个帅哥?

Jim*_*uls 46

除了'y'和'n'之外,当你问起一个大块头时,你可以给出的答案之一是"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 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
Run Code Online (Sandbox Code Playgroud)

  • 如果您*真的需要控制,请尝试'e'直接编辑补丁.这样您甚至可以更改补丁内容(而不仅仅是选择补丁的一部分). (3认同)

Bom*_*mbe 11

git gui 将允许您提交单行,即使它们被您不想提交的其他修改行包围.

  • 你也可以用git可乐做同样的事情. (2认同)