在我的存储库中,我使用以下命令创建了标记。

git tag v1.0.0 -m 'finally a stable release'
git tag v2.0.0 -m 'oops, there was still a major bug!'

如何列出存储库中的所有标记?


当前回答

此外,git show ref非常有用,因此您可以直接将标记与对应的提交关联起来:

$ git tag
osgeolive-6.5
v8.0
...

$ git show-ref --tags
e7e66977c1f34be5627a268adb4b9b3d59700e40 refs/tags/osgeolive-6.5
8f27e65bddd7d4b8515ce620fb485fdd78fcdf89 refs/tags/v8.0
...

其他回答

此外,git show ref非常有用,因此您可以直接将标记与对应的提交关联起来:

$ git tag
osgeolive-6.5
v8.0
...

$ git show-ref --tags
e7e66977c1f34be5627a268adb4b9b3d59700e40 refs/tags/osgeolive-6.5
8f27e65bddd7d4b8515ce620fb485fdd78fcdf89 refs/tags/v8.0
...

下面是如何查找远程标记:

git-ls-remote—标记原点

您可以列出所有现有标记git-tag,也可以使用git-tag-l“v1.1.*”过滤列表,其中*充当通配符。它将返回标记为v1.1的标签列表。

您将注意到,当您调用git标记时,无法看到注释的内容。要预览它们,必须在命令中添加-n:gittag-n2。

$ git tag -l -n2

v1.0版本1.0

v1.1版本1.1

该命令列出了所有现有标记,最多包含3行标记消息。默认情况下,-n只显示第一行。有关更多信息,请务必查看与标签相关的文章。

要查看有关最新可用标签的详细信息,我有时会使用:

git show `git describe` --pretty=fuller

尝试生成git标记,如果不尝试生成gitfetch,那么就应该足够了。