繁体   English   中英

git描述给不同的标签

[英]Git describe giving different tags

我已经用标记“ Release_V1.0.0.4”标记了我的存储库。 但是这是我从“ git describe”和“ git describe origin”中得到的。

[root pds_series]#git describe

Release_V1.0.0.2-22-g0859de9

[root pds_series]#git描述来源

Release_V1.0.0.2-18-gce2b24c

使用“ git describe --all”和“ git describe --tags”,我得到了正确的标签。

[root pds_series]#git describe --all

标签/ Release_v1.0.0.4

[root pds_series]#git describe --tags

Release_v1.0.0.4

另外,通过以下命令,我得到了正确的标签。

[root pds_series]#git log --pretty = format:'%ad%h%d'--abbrev-commit --date = short -1

2012-11-15 0859de9(HEAD,Release_v1.0.0.4,master)

有人知道这背后的原因吗? 我该如何解决这个问题?

您可能使用了“轻量级”标签。 默认情况下, git describe仅使用标记对象来描述提交,而使用--tags ,即使它们直接指向提交而不是标记对象,它也会在refs/tags下使用任何引用。

要创建标签对象,必须对git tag使用-a (带注释)或-s-u (带符号)选项之一,否则将创建轻量级标签(直接指向提交的引用)。

要查看两个标签之间的区别,请尝试:

git cat-file -t Release_V1.0.0.2

和:

git cat-file -t Release_v1.0.0.4

上可能会说“标签”,而另一个会说“提交”。

要解决该问题,您可以使用-f和(say) -a重新创建标签。

git tag -f -a Release_v1.0.0.4 Release_v1.0.0.4

暂无
暂无

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

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