如何从 GitHub 中的特定提交快速获取补丁?

bat*_*sta 0 github format-patch git-commit

我在 GitHub 存储库上有一个特定的提交,我想从中提取补丁以应用到不同的地方,类似于我在使用git format-patch.

我很懒,或者存储库太大,我不想为了提取该补丁而获取整个存储库。

我怎样才能快速做到这一点?

Chr*_*ris 5

  1. 浏览到适当的提交,例如

    https://github.com/github/gitignore/commit/e9552d855c356b062ed82b83fcaacd230821a6eb

  2. 编辑地址栏中的 URL 并添加.diff到末尾,例如

    https://github.com/github/gitignore/commit/e9552d855c356b062ed82b83fcaacd230821a6eb.diff

  3. 复制并粘贴(或文件 > 保存)统一差异

您也可以使用.patch代替.diff,它似乎生成适合使用 的应用程序的输入git am

  • 太棒了,我一直在寻找 **补丁**,然后我可以使用 `curl` 直接将其通过管道传输到 `git am`。`curl <提交网址>.patch | git am`谢谢! (3认同)