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

I'm currently busy with a project with a lot of branches and I have a tag for last changes which where done on one of the branches. But it's not clear for me on which branch this tag is.

How to find out on which branch a tag is?


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>

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


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.