How can I list tags contained by a given branch, the opposite of:
git tag --contains <commit>
Which "only list tags which contain the specified commit".
If something like this does not exist, how do I test whether a commit is contained by another commit so that I can script this?
I could do this:
commit=$(git rev-parse $branch)
for tag in $(git tag)
do
git log --pretty=%H $tag | grep -q -E "^$commit$"
done
But I hope there is a better way as this might take a long time in a repository with many tags and commits.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…