简体   繁体   English

如何在没有标签的repos上使用`git describe`?

[英]How to use `git describe` on repos without tags?

For most of our repos, we use git describe --tags to print a version number like v1.0.4-14-g2414721 . 对于我们的大部分回购,我们使用git describe --tags来打印版本号,如v1.0.4-14-g2414721 However, this fails if the repo doesn't have any tags yet. 但是,如果repo还没有任何标签,则会失败。

Is there a flag of git describe or something similar that would work around this? 是否有一个git describe的标志或类似的东西可以解决这个问题?

git-describe offers --always to give a fallback option. git-describe提供 - --always提供后备选项。 If you have any tags those are used, otherwise just the most recent commit id. 如果您使用了任何标记,则只使用最新的提交ID。

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

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