Is it possible with Git to retrieve a list of tags that exist only in a certain branch?

前端 未结 2 1276
迷失自我
迷失自我 2020-12-18 01:08

I would like to know if it\'s possible in Git to retrieve a list of tags (much like the result of the git tag command), but the list should be limited only to a

2条回答
  •  失恋的感觉
    2020-12-18 01:57

    I think this will do what you want:

     git log --pretty='%H'  |
       xargs -n1 git describe --tags --exact-match 2>/dev/null
    

    This uses git log to get a list of commits in a branch, and then passes them to git describe to see if they correspond to a tag.

提交回复
热议问题