How to create patch between two tags with multiple commits between them?

别来无恙 提交于 2020-01-10 07:21:06

问题


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?


回答1:


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.




回答2:


You can create a single patch for multiple commits by using the --stdout option and directing the output to a file:

git checkout tag2
git format-patch tag1 --stdout > patch1to2.patch


来源:https://stackoverflow.com/questions/9078820/how-to-create-patch-between-two-tags-with-multiple-commits-between-them

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!