Reputation: 25054
I have a git commit hash and I'm interested in finding which tags contain this commit. This seems like it should be easy, but I've been unable to find any solution. How can I achieve this with git?
Upvotes: 1
Views: 55
Reputation: 14843
If you are sitting at your terminal and wish to know then
git tag --contains
If you are trying to get this information for a script and
-- you are using an older version of Git (<= 2.5) then you will need to script around git for-each-ref
and git merge-base --is-ancestor
as described in this answer.
-- you are using a newer versions of Git (>=2.6) then you would use git for-each-ref --contains
. This is both simpler and has better performance.
Upvotes: 2