git/list[1] front-page[2] threads[3] people[4] search[5] about
 

List tags for a certain branch

From
CCoDEmanX <codemanx@gmx.de>
Date
Aug 23, 2015, 15:27 UTC
Message-ID
<55D9E672.4050503@gmx.de>
Hi everyone,

the question how to list tags, that point to commits contained in a certain branch came up on StackOverflow couple times, and this appears to be the only fast solution (example for local devel branch):

     git log --simplify-by-decoration --decorate --pretty=%d 
"refs/heads/devel" | fgrep 'tag: '

It would be much much simpler, if the tag command supporter an optional parameter to specify a branch:

     git tag --list --branch devel
It should result in something like:

Test-Tag1 Test-Tag2 Test-Tag3 Another-Tag And-Another

... even if all three Test-Tag* tags point to the same commit!
What above mentioned git log-solution does in this situtation is:
  (HEAD, tag: Test-Tag1, tag: Test-Tag2, Test-Tag3, fork/devel, devel)
  (tag: Another-Tag)
  (tag: And-Another)
BTW: git describe FULL_HASH can't be used to return all tags that point 
to the given hash. The only workaround seems to be:
     git for-each-rev ref/tags | grep FULL_HASH

I hope you consider to add the proposed --branch option to a future git version. Thanks!

SO question that started the discussion:
http://stackoverflow.com/questions/32166548/how-to-list-all-tags-within-a-certain-git-branch

Best, Cody

Next: Jeff King
Message 1 of 4 in “List tags for a certain branch”
  1. CoDEmanXAug 23, 2015
  2. Jeff KingAug 23, 2015
  3. CoDEmanXAug 23, 2015
  4. Jeff KingAug 23, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.