Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can git list the tags that occur between two particular commits?

Tags:

git

commit

tags

Is there a way to get git to list all the tags that were added in between two commits? That is, only show me the tags that appear between point A and point B.

like image 599
Matt V. Avatar asked May 09 '13 00:05

Matt V.


People also ask

How do I find the commit between two tags?

Comparing The Two TagsUsing the same side menu, select one of your commits as the compare branch. Now, select the 'Compare Tags' option on the other tag and start comparing the two tags. Click 'Files' to see what has changes between the two tags.

How will you list your tags in git?

Listing the available tags in Git is straightforward. Just type git tag (with optional -l or --list ). You can also search for tags that match a particular pattern. The command finds the most recent tag that is reachable from a commit.

How do you fetch a tag?

To fetch tags from your remote repository, use “git fetch” with the “–all” and the “–tags” options. Let's say for example that you have a tag named “v1. 0” that you want to check out in a branch named “release”. Using this command, you have successfully checked out the “v1.


2 Answers

You can use the git log command with these options:

git log tagA...tagB --decorate --simplify-by-decoration

--decorate displays the tag names next to the commit, and --simplify-by-decoration shows only commits that have been tagged.

like image 100
Robert Gomez Avatar answered Sep 21 '22 10:09

Robert Gomez


If you only wants the tag name list (in reverse chronological order) between commit1 and commit2, you can combine git log with xargs and git tag --points-at:

git log commit1..commit2 --simplify-by-decoration --format=format:%h | xargs -L1 git tag --points-at
like image 45
gentooboontoo Avatar answered Sep 23 '22 10:09

gentooboontoo