git - 将 svn 补丁应用到 git 存储库

标签 git svn patch

好的,我已经尝试了在 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/

相关文章:

svn - git svn windows linux 空格问题

git - Vim:Fugitive:Glog - 如何获取当前文件的提交而不是修订

ruby-on-rails - Monkey(也许?)在我的 Rails 应用程序中修补一个 Gem

linux - 定位扩展属性

git 不会推送到远程分支 "Everything up-to-date"

svn - 重新设置/更新 git-svn 存储库时出错

c# - 将 svn 的输出读入字符串

svn - TortoiseSVN 文件夹重命名总是失败

git 等同于 svn ls -R -v?

python - subprocess.call() 中的 Pytest 模拟全局变量