Is there a way to find out if a tag is a child or parent (not the direct child or parent)?
Imagine the following git history:
a467066 - (tag: child-2, master) feature 4
2028351 - (tag: child-1) feature 3
a7a6364 - (HEAD) feature 2
3772445 - (tag: parent-1) feature 1
5a01bfa - (tag: parent-2) initial commit
My HEAD is in the middle changeset ("feature 2") and I want to know if a tag is any child to the current changeset. So for child-1 and child-2 I want a true, checking the tags parent-1, parent-2 or any not-existing would return false.
git tag --contains HEAD
It lists all the tags that are descendants of HEAD
git merge-base <tag> <HEAD>
If it returns the commit of HEAD, then tag is a descendant of HEAD.
git merge-base --is-ancestor <tag> <HEAD>
If tag is an ancestor of HEAD, the command's exit status is 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With