Git: How to find out on which branch a tag is?

In regards to @VonC's comment about finding the commit referenced by a tag, just use:

git show <tag>

Since a tag is tied to a specific commit, it can be used to show that commit - which will give you the full commit details.


Even shorter:

git branch --contains tags/<tag>

(it works for any tree-ish reference)


If you can find which commit a tag refers to:

 git rev-parse --verify tags/<tag>^{commit}
 # or, shorter:
 git rev-parse tags/<tag>~0

Then you can find which branch contain that commit.

git branch --contains <commit>

As commented below by user3356885, for the fetched branches (branches in remotes namespace)

git branch -a --contains tags/<tag>
git branch -a --contains <commit>

As noted in Pyr3z's answer, for each candidate tag listed above, you can add:

git log -1 --pretty='%D' TAG

That will show the branches associated to that tag.


If "git branch --contains " does nothing, be sure that you are including all branches, both remote and local branches:

git branch -a --contains <tag>

From the git help:

Specific git-branch actions: -a, --all list both remote-tracking and local branches

Tags:

Branch

Git

Tags