git - 如何应用由 git format-patch 生成的补丁?

标签 git patch

我有两个本地 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 

查看 example in this article :

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.

Example

关于git - 如何应用由 git format-patch 生成的补丁?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2249852/

相关文章:

git - 如何使用可恢复的有意义的提交消息进行小更改?

尝试在 MAC 上克隆 GIT 时出现 javax.net.ssl.SSLHandshakeException

Python Mocking - 如何修补函数内的变量

git - 如何应用 git 补丁,就像作者 promise 我的存储库一样?

c++ - 运行时进程内存修补以恢复状态

git - 分支是什么时候从 master 上 fork 出来的?

git - 从 GIT 提交消息中删除的 YouTrack 命令

windows - (脚本)使用PowerShell或cmd的Windows最新Git?

magento - 如何应用magento 1 MPERF-1050 9-patch

git - Git 可以用来更新客户端计算机上的软件吗?