Joyce Babu
Joyce Babu

Reputation: 20654

Get a list of all tags between two commits

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]*'

Upvotes: 8

Views: 454

Answers (2)

Francesco
Francesco

Reputation: 4250

If you can use the comm command, check out this solution

comm -23 <(git tag -l phinx-* --contains <sha1 start>) <(git tag -l phinx-* --contains <sha1 end>)

Upvotes: 1

VonC
VonC

Reputation: 1323793

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.

Upvotes: 2

Related Questions