简体   繁体   English

最新的git标签未与git describe命令一起出现

[英]Latest git tag not appearing with git describe command

Currently our CI builds on the latest git tag, git describe --tags $(git rev-list --tags --max-count=1) 当前,我们的CI基于最新的git标签, git describe --tags $(git rev-list --tags --max-count=1)

We have a scenario where a remote dev is tagging but the tag is only appearing with the command 我们有一个场景,其中一个远程开发人员正在标记,但该标记仅与命令一起出现

git describe --abbrev=0

the tag is not appearing with the first command. 该标记未与第一个命令一起出现。

git rev-list --tags will list every commit reachable from any tag, in reverse chronological order . git rev-list --tags将以相反的时间顺序列出任何标签可到达的每个提交。 Adding --max-count=1 limits the output to the first commit that would otherwise be displayed. 添加--max-count=1会将输出限制为否则将显示的第一次提交。 So that command shows the newest commit that has a tag. 因此,该命令将显示具有标签的最新提交。

If any user tags a commit, but it's not newer than every commit that already has a tag, it won't show. 如果有任何用户标记了一个提交,但它并不比每个已经具有标记的提交都新,它将不会显示。 I'm guessing, for your usage, that this sounds ok -- though do note that's newest commit , not newest tag . 我想,对于您的用法,这听起来还不错-尽管请注意这是最新的commit ,而不是new tag

Your remote dev, though... is his clock in sync with your local clock? 但是,您的远程开发人员...他的时钟与您的本地时钟同步吗?

You might be able to improve the situation by adding the --topo-order flag, which ensures that a commit cannot be listed until all of its children have been listed. 您可能可以通过添加--topo-order标志来改善这种情况,该标志可确保在列出所有子项之后才能列出提交。

There are several ways to get the git latest tag from the current branch your in. I just mentioned only simple approaches. 有几种方法可以从当前分支中获取git最新标签。我仅提到了简单的方法。

Answer to your question most simple way is to use this will provide the latest git tag 回答您问题的最简单方法是使用它将提供最新的git标签

 $ git describe --tags

and another simple approach which you already mentioned your doing that 还有您已经提到过的另一种简单方法

$ git describe --tags --abbrev=0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM