How to get the branch from tag name in Git?

前端 未结 3 1893
栀梦
栀梦 2021-01-19 16:51

I am trying to get the branch name from a given tag. I tried git describe --tag but this doesn\'t provide me any branch name. I tried using

3条回答
  •  醉酒成梦
    2021-01-19 17:13

    Tags and Branches in Git are only Labels pointing to specific snapshot of your files. That being said, Tags ain't linked to a branch, but to a commit.

    As so, you have to check wich branch contain the commit pointed by your tag, as so:

    git branch --contains 
    

提交回复
热议问题