willpnw
willpnw

Reputation: 775

Which tag happened after a commit in git?

For a given commit, is it possible to determine the closest tag after the commit? I could not figure out how to do this with git describe or git log?

Example: We tag all our releases. I would like to generate release notes which describe which release a commit went into. I can get the most recent tag, but that only shows which release preceded it. I want to know which release came after it

Upvotes: 0

Views: 187

Answers (2)

uhausbrand
uhausbrand

Reputation: 158

How about git describe --contains ?

from git documentation:

--contains Instead of finding the tag that predates the commit, find the tag that comes after the commit, and thus contains it. Automatically implies --tags.

Upvotes: 1

Unsigned
Unsigned

Reputation: 9916

Sounds like you want git describe --contains <commit>

--contains

Instead of finding the tag that predates the commit, find the tag that comes after the commit, and thus contains it. Automatically implies --tags.

Upvotes: 0

Related Questions