作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我希望将一些提交从一个存储库移动到另一个存储库,我想保留原始提交、日期和提交消息等所有内容,而不是将整个内容压缩在一起。 git format-patch master
明白了,每次提交都制作一个 .patch 文件,但我在应用它们时遇到了一些麻烦(我卡在了第一次提交上)。
git apply <patch file name>
干净地应用更改,没有冲突或任何东西,但当然它不会创建我想要的提交。
git am --committer-date-is-author-date -3 < <patch file name>
,另一方面,没有明确的解决方法失败:
Applying: <original commit message>
error: patch failed: war/WEB-INF/web.xml:162
error: war/WEB-INF/web.xml: patch does not apply
<more files listed, all of them ones that I've modified in the commit; newly created files are not listed>
error: Did you hand edit your patch?
It does not apply to blobs recorded in its index.
hint: Use 'git am --show-current-patch' to see the failed patch
Using index info to reconstruct a base tree...
M war/WEB-INF/web.xml
Patch failed at 0001 <commit message>
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
运行后,我的工作副本或暂存副本没有任何变化。我希望得到带有 merge 冲突样式标记( <<<<<<<<
和 >>>>>>>>
)的更改文件,因为我使用了 -3
旗帜,但我什至没有。
有没有办法运行git am
得到我想要的东西,还是应该使用 git apply
并做出新的 promise ?
最佳答案
你可以试试--reject .它应用补丁的适用部分,并将被拒绝的大块留在相应的 *.rej 文件中。当 -3
不能正常工作时,它会有所帮助。
关于git - 如何将 git am 的 "patch does not apply"解决为 merge 冲突?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59453367/
我是一名优秀的程序员,十分优秀!