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?

  • Git - How to remove a large file from commit history so I can push repository?
  • git doesn't auto commit when I pull
  • git without bash/cygwin
  • What does GitHub for Windows/Mac “publish” do?
  • MongoDB backup as text rather than binary for source control
  • Which files of an autoconf project to put into .gitignore?
  • How to show full history of tags in git?
  • How to Pull from github and keep local file without resolving merge conflicts
  • How to cache github repos so 2nd git clone will use the cache instead of github repo
  • Error when “git push” to github
  • GIT - who pushed/wrote most code
  • How to disable direct push to Gerrit?
  • 2 Solutions collect form web for “How to create patch between two tags with multiple commits between them?”

    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.

    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
    Git Baby is a git and github fan, let's start git clone.