我有两个本地 git 存储库,都指向相同远程存储库。
在一个 git 存储库中,如果我执行 git format-patch 1
,我如何将该补丁应用到另一个存储库?
最佳答案
注意:您可以先预览补丁的作用:
首先是统计数据:
git apply --stat a_file.patch
然后试运行以检测错误:
git apply --check a_file.patch
最后,你可以使用 git am
将您的补丁作为提交应用。这也允许您 sign off应用补丁。
这对以后的引用很有用。
git am --signoff < a_file.patch
In your git log, you’ll find that the commit messages contain a “Signed-off-by” tag. This tag will be read by Github and others to provide useful info about how the commit ended up in the code.
关于git - 如何应用由 git format-patch 生成的补丁?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2249852/