Rishi
Rishi

Reputation: 3539

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

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?

Upvotes: 70

Views: 60910

Answers (3)

Ronak Patel
Ronak Patel

Reputation: 130

If you want multiple patches, then you can apply below command

$ git format-patch tag1..tag2

Upvotes: 0

Patrick Sanan
Patrick Sanan

Reputation: 2485

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

Upvotes: 54

fajran
fajran

Reputation: 2809

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.

Upvotes: 90

Related Questions