Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get a list of all tags between two commits

Tags:

git

git-tag

I have two commit hashes and want to list all the tags that begin with phinx- between these two commit hashes. How can I do it?

Edit:

This is what I have come up with. Is there a better solution

git log --pretty=format:'%D' 35164f33..49085fbe | grep -o 'tag: phinx-[0-9]*'
like image 274
Joyce Babu Avatar asked Apr 22 '16 06:04

Joyce Babu


People also ask

How do I get a list of all commits?

On GitHub.com, you can access your project history by selecting the commit button from the code tab on your project. Locally, you can use git log . The git log command enables you to display a list of all of the commits on your current branch. By default, the git log command presents a lot of information all at once.

Which command displays the list of all commits?

git log -p command displays the patch representing each commit.

How do I find the difference between two commits in git?

To see the changes between two commits, you can use git diff ID1.. ID2 , where ID1 and ID2 identify the two commits you're interested in, and the connector .. is a pair of dots. For example, git diff abc123.. def456 shows the differences between the commits abc123 and def456 , while git diff HEAD~1..

How do I see git tags?

Find Latest Git Tag Available In order to find the latest Git tag available on your repository, you have to use the “git describe” command with the “–tags” option. This way, you will be presented with the tag that is associated with the latest commit of your current checked out branch.


1 Answers

A quick hack could be:

git log --oneline --decorate <sha1>..<sha1>|grep "tag:"| grep "phinx-"

An actual solution might be more complex and involve git rev-list.

like image 97
VonC Avatar answered Oct 22 '22 06:10

VonC