在git中提交后哪个标签发生了? [英] Which tag happened after a commit in git?
问题描述
对于给定的提交,是否可以确定提交之后最接近的标签?我不知道如何使用git describe或git log做到这一点?
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
推荐答案
git describe --contains 如何?
来自 git文档:
-包含 而不是查找提交之前的标签,而是查找提交之后的标签,从而包含该标签.自动隐含--tags.
--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.
这篇关于在git中提交后哪个标签发生了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!