好的,我已经尝试了在 stackoverflow 上可以找到的所有答案,但显然没有一个能够解决我的问题。我想将 SVN 制作的补丁应用到 git 存储库。显然,最简单的方法是使用“git apply”,但这似乎不起作用。
$ git apply --ignore-space-change --ignore-whitespace < xxx_parser.patch
<stdin>:10: trailing whitespace.
FORCE_LA_CHECK = false; stdin:23: trailing whitespace.
<stdin>:79: trailing whitespace
.
.
.
.
error: pmd/grammar/JspParser.jjt: No such file or directory
error: patch failed: pmd/pom.xml:251
error: pmd/pom.xml: patch does not apply
这是xxx_parser.patch的内容:
$ head xxx_parser.patch Index: etc/grammar/JspParser.jjt
--- etc/grammar/JspParser.jjt (revision 7704)
+++ etc/grammar/JspParser.jjt (working copy)
现在为什么它提示找不到文件 pmd/grammar/JspParser.jjt?
补丁中的路径指向正确的目录。
最佳答案
我在使用 git 应用 SVN 生成的补丁时遇到了一些问题。我建议直接使用 patch
命令应用任何颠覆补丁,并使用 git 验证所述补丁是否已成功应用。
$ patch -p0 < xxx_parser.patch
$ git diff
关于git - 将 svn 补丁应用到 git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11519230/