我有一个叫my_pcc_branch。patch的补丁。
当我尝试应用它时,我得到以下信息:
$ git apply --check my_pcc_branch.patch
warning: src/main/java/.../AbstractedPanel.java has type 100644, expected 100755
error: patch failed: src/main/java/.../AbstractedPanel.java:13
error: src/main/java/.../AbstractedPanel.java: patch does not apply
这是什么意思?
我该如何解决这个问题?
Git apply——reject——whitespace=fix mychanges。帕奇为我工作。
解释
——reject选项将指示git在无法确定如何应用补丁时不要失败,而是应用它可以应用的单个块,并为它不能应用的块创建拒绝文件(.rej)。Wiggle可以“应用[这些]被拒绝的补丁,并执行文字差异”。
此外,——whitespace=fix将警告空格错误并尝试修复它们,而不是拒绝应用其他适用的块。
这两个选项一起可以使补丁应用程序在失败时更加健壮,但是它们需要额外关注结果。
完整的文档请参见https://git-scm.com/docs/git-apply。
What I looked for is not exactly pointed out in here in SO, I'm writing for the benefit of others who might search for similar. I faced an issue with one file (present in old repo) getting removed in the repo. And when I apply the patch, it fails as it couldn't find the file to be applied. (so my case is git patch fails for file got removed)
'#git apply --reject' definitely gave a view but didn't quite get me to the fix. I couldn't use wiggle as it is not available for us in our build servers. In my case, I got through this problem by removing the entry of the 'file which got removed in the repo' from patch file I've tried applying, so I got all other changes applied without an issue (using 3 way merge, avoiding white space errors), And then manually merging content of file removed into where its moved.
Git apply——reject——whitespace=fix mychanges。帕奇为我工作。
解释
——reject选项将指示git在无法确定如何应用补丁时不要失败,而是应用它可以应用的单个块,并为它不能应用的块创建拒绝文件(.rej)。Wiggle可以“应用[这些]被拒绝的补丁,并执行文字差异”。
此外,——whitespace=fix将警告空格错误并尝试修复它们,而不是拒绝应用其他适用的块。
这两个选项一起可以使补丁应用程序在失败时更加健壮,但是它们需要额外关注结果。
完整的文档请参见https://git-scm.com/docs/git-apply。