我已经创建了一个补丁,它修改了一系列文件,并添加了一些新的文件。
我试图在旧版本分支上应用此修补程序,但由于树中不存在修改过的文件,该修补程序失败了。
(部分错误摘录)
error: polyglot/java.hh: does not exist in index
error: polyglot/v7.hh: does not exist in index
这是因为修改后的文件在旧版本分支中不存在的提交中从.h重命名为.hh。
考虑到我正在修改以.hh结尾的文件,但是树包含那些带有.h结尾的文件,那么如何应用这个修补程序呢?
发布于 2022-10-07 05:41:14
尝试将其应用于可以应用的更新提交(不一定是更新的,它可以更老,任何允许您应用修补程序的内容),然后在您真正想要的修订版的基础上选择最终提交。所以..。就像这样
git checkout -b temp <one-commit--or-branch-that-allows-the-patch-to-be-applied>
git apply some-patch
git add .
git commit -m "Here's a patch I need to be applied"
git checkout <where-i-really-want-it-applied>
git cherry-pick temp
那应该管用。
发布于 2022-10-07 06:24:23
最快捷的方法是:编辑修补程序文件中的文件名。
# change this line :
diff --git a/polyglot/java.hh b/polyglot/java.hh
# to :
diff --git a/polyglot/java.h b/polyglot/java.h
https://stackoverflow.com/questions/73982751
复制相似问题