How to compare two tags with git?

Git

Git Problem Overview


I would like to do a diff between two tags and committed changes between those two tags. Could you please tell me the command?

Git Solutions


Solution 1 - Git

$ git diff tag1 tag2

or show log between them:

$ git log tag1..tag2

sometimes it may be convenient to see only the list of files that were changed:

$ git diff tag1 tag2 --stat

and then look at the differences for some particular file:

$ git diff tag1 tag2 -- some/file/name

A tag is only a reference to the latest commit 'on that tag', so that you are doing a diff on the commits between them.

(Make sure to do git pull --tags first)

Also, a good reference: https://git-scm.com/docs/git-diff

Solution 2 - Git

If source code is on Github, you can use their comparing tool: https://help.github.com/articles/comparing-commits-across-time/

Solution 3 - Git

For a side-by-side visual representation, I use git difftool with openDiff set to the default viewer.

Example usage:

git difftool tags/<FIRST TAG> tags/<SECOND TAG>

If you are only interested in a specific file, you can use:

git difftool tags/<FIRST TAG>:<FILE PATH> tags/<SECOND TAG>:<FILE PATH>

As a side-note, the tags/<TAG>s can be replaced with <BRANCH>es if you are interested in diffing branches.

Solution 4 - Git

As @Nakilon said, their is a comparing tool built in github if that's what you use.

To use it, append the url of the repo with "/compare".

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionbsdView Question on Stackoverflow
Solution 1 - GitgautehView Answer on Stackoverflow
Solution 2 - GitNakilonView Answer on Stackoverflow
Solution 3 - GitTom HowardView Answer on Stackoverflow
Solution 4 - GitLulupointuView Answer on Stackoverflow