“git描述”忽略标签 [英] "git describe" ignores a tag

查看:113
本文介绍了“git描述”忽略标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下几行:

  $ git tag -n1 
v1.8标签前天
v1.9标签昨天
v2.0今天标签
$ git describe
v1.9-500-ga6a8c67
$

任何人都可以解释为什么v2.0标签没有被git describe使用,以及如何解决这个问题? v2.0标签已经被推送,所以我猜测我不能只是删除并重新添加它。 解决方案

git describe 默认只使用带注释的标签。指定 - tags 选项以使其使用轻量级标记



确保您已检出正确提交( git rev-parse HEAD )。使用 git tag -a 创建带注释的标签。如果您执行的是 git show<标记名称> ,并且您只看到提交,那么它是一个轻量级标记,如果您看到附加标记消息,那么它就是一个带注释的标记。


In the following lines:

$ git tag -n1
v1.8        Tagged the day before yesterday
v1.9        Tagged yesterday
v2.0        Tagged today
$ git describe
v1.9-500-ga6a8c67
$ 

Can anyone explain why the v2.0 tag is not used by "git describe", and how to fix this? The v2.0 tag is already pushed, so I am guessing that I can't just delete and re-add it.

解决方案

git describe uses only annotated tags by default. specify the --tags option to make it use lightweight tags as well

make sure you've checked out the correct commit (git rev-parse HEAD). annotated tags are created with git tag -a. if you do git show <tagname> and you see the commit only, it's a lightweight tag, if you see an additionial tag message it's an annotated tag.

这篇关于“git描述”忽略标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆