git 如何在两个标签之间创建补丁并在它们之间进行多次提交?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9078820/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create patch between two tags with multiple commits between them?
提问by Rishi
I have two tags in my git in same branch. There are at least 5-6 commits between them. How can I create a single patch between the two tags so that it can be applied to a GitHub repo?
我的 git 在同一个分支中有两个标签。它们之间至少有 5-6 次提交。如何在两个标签之间创建单个补丁,以便将其应用于 GitHub 存储库?
回答by fajran
You can create a single diff (patch) between two tags using the following
您可以使用以下方法在两个标签之间创建单个差异(补丁)
$ git diff tag1 tag2 -- > the-patch.diff
Replace tag1
and tag2
to the tags you want.
替换tag1
和tag2
到您想要的标签。
回答by Patrick Sanan
You can create a single patch for multiple commits by using the --stdout
option and directing the output to a file:
您可以通过使用该--stdout
选项并将输出定向到文件来为多个提交创建单个补丁:
git checkout tag2
git format-patch tag1 --stdout > patch1to2.patch