Re: List tags for a certain branch
From: Jeff King <hidden>
Date: 2016-06-15 23:06:16
On Sun, Aug 23, 2015 at 05:27:46PM +0200, CoDEmanX wrote:
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-AnotherI 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".