git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: CoDEmanX <codemanx@gmx.de>
To: git@vger.kernel.org
Subject: List tags for a certain branch
Date: Sun, 23 Aug 2015 17:27:46 +0200	[thread overview]
Message-ID: <55D9E672.4050503@gmx.de> (raw)

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

             reply	other threads:[~2015-08-23 15:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-23 15:27 CoDEmanX [this message]
2015-08-23 17:07 ` List tags for a certain branch Jeff King
2015-08-23 18:06   ` CoDEmanX
2015-08-23 18:58     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55D9E672.4050503@gmx.de \
    --to=codemanx@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).