git reset -p
的用例是什么,然后在重置之前使用“ e”选项编辑已应用的大块?
我尝试使用该命令,但是git拒绝了我尝试的所有编辑。
答案 0 :(得分:0)
我认为手册页解释了用例,以及您遇到的常见陷阱(为格式进行了编辑):
if (words != null) {
words.clear();
}
我已经看到人们有效地使用了该命令;这对于删除多余的行和空格,记录器和调试器语句,或修复最新的拼写错误非常有用。但应谨慎使用,因为创建不适用的补丁很容易。
在这种情况下,您可以使用-e, --edit
Open the diff vs. the index in an editor and let the user edit it.
After the editor was closed, adjust the hunk headers and apply the patch
to the index.
The intent of this option is to pick and choose lines of the patch to
apply, or even to modify the contents of lines to be staged. This can be
quicker and more flexible than using the interactive hunk selector.
However, it is easy to confuse oneself and create a patch that does not
apply to the index. See EDITING PATCHES below.
放弃更改,并在文本编辑器中进行正确的更改。
有关更多信息,请参见n
。