Git Gui 错误 - 无法暂存所选行...补丁不适用
Git Gui error - Failed to stage selected line ... patch does not apply
我使用 Git Gui,当我尝试暂存选定的行时,我很少会收到错误消息框:
Failed to stage selected line.
error: patch failed: Foo/Bar.json:103
error: Foo/Bar.json: patch does not apply
不过,暂存整个文件是可行的。
有谁知道可能导致此错误的原因是什么?
有没有人在使用Git Gui时遇到过?
首先,确保使用最近的 Git(最新的 2.23)最小值。
正如我在“Why does git stash -p
sometimes fail?", git stash
(由 git-gui 调用)中解释的那样,自 Git 2.17(2018 年第二季度)以来已经有了一系列改进。
This happens for me any time I try to split a hunk into smaller hunks that are too close together (less than 3 lines between changes).
The short explanation is that the patch has context lines in it that conflict with your local changes.
在“”查看更多信息。
使用 ,最小化 hunk 上下文足迹。
在我的例子中,这是因为我启用了 -w
作为 diff 参数。删除它解决了问题。
我使用 Git Gui,当我尝试暂存选定的行时,我很少会收到错误消息框:
Failed to stage selected line. error: patch failed: Foo/Bar.json:103 error: Foo/Bar.json: patch does not apply
不过,暂存整个文件是可行的。
有谁知道可能导致此错误的原因是什么? 有没有人在使用Git Gui时遇到过?
首先,确保使用最近的 Git(最新的 2.23)最小值。
正如我在“Why does git stash -p
sometimes fail?", git stash
(由 git-gui 调用)中解释的那样,自 Git 2.17(2018 年第二季度)以来已经有了一系列改进。
This happens for me any time I try to split a hunk into smaller hunks that are too close together (less than 3 lines between changes).
The short explanation is that the patch has context lines in it that conflict with your local changes.
在“
使用
在我的例子中,这是因为我启用了 -w
作为 diff 参数。删除它解决了问题。