Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compare two tags with git?

Tags:

git

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

like image 999
bsd Avatar asked Jul 09 '10 10:07

bsd


People also ask

Can we compare two commits in git?

You can compare files between two Git commits by specifying the name of the ref that refers to the commits you want to compare. A ref may be a commit ID or HEAD, which refers to the current branch. Let's compare two commits in our Git repository. The above command will perform a diff operation across our two commits.

How do I compare a branch with a tag?

You can access the "Compare branches/tags" page from the branch or the tag page. Choose the branches or tags that you want to compare. Commits tab shows the differences of commits between the branches or the tags. Files tab shows the differences of files between the branches or the tags.


2 Answers

$ 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

like image 189
gauteh Avatar answered Sep 27 '22 19:09

gauteh


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

like image 45
Nakilon Avatar answered Sep 27 '22 18:09

Nakilon