[英]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.