Re: List tags for a certain branch
- From
Jeff King <peff@peff.net>
- Date
- Aug 23, 2015, 17:07 UTC
- Message-ID
- <20150823170751.GA24194@sigill.intra.peff.net>
- In-Reply-To
- <55D9E672.4050503@gmx.de>
On Sun, Aug 23, 2015 at 05:27:46PM +0200, CoDEmanX wrote:
Show 19 quoted lines
> 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
I think the option you are looking for is "--merged", which currently only the "branch" command nows about. So right now you can do:
git branch --merged devel
to get a list of branches that are contained in "devel". There is work underway to unify the selection/filter code for git-branch and git-tag, so in a future version of git you should be able to do "git tag --merged" to get the tags that are "merged" to a particular branch.
-Peff
PS I'm not sure if we should pick a more generic name than "--merged" when git-tag learns this feature. For branches, it makes sense to ask "which branches are merged to this other branch". But the operation is really "which items are ancestors of the commit I gave". It is the opposite of "--contains" in that sense. Sort of a "--contained-in".