本文介绍了如何列出所有Git标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的资源库中,我使用以下命令创建了标签。

  git标签v1.0.0 -m'终于稳定版'
git标签v2.0.0 -m'oops ,还有一个重大的错误!'

你如何列出资料库中的所有标签?

解决方案
  git tag 

应该足够了。请参阅






您还有:

  git tag -l< pattern> 








最近(,适用于Git 2.0+)

  git tag --sort =< type> 








同时列出:

$ ul

  • :存储在Git数据库中的完整对象。他们进行了校验和;包含标记名称,电子邮件和日期;有一个标记消息;并且可以使用GNU Privacy Guard(GPG)进行签名和验证。 :指向现有提交的简单指针


    请注意:关于标记的不支持轻量级标签。






    也就是说, 指出,' git tag -m...'实际上意味着一个正确的(未注释的注释)标签(选项' -a '),而不是轻量级的。所以你对你的初始命令很好。






    这不同于:

      git show-ref --tags -d 

    其中列出了提交的标签(请参阅)。

    请注意 -d ,以便对带注释的标记对象(具有自己的提交SHA1)进行解引用并显示实际标记的提交。



    同样, git show --name-only< aTag> 会列出标签和相关的提交。


    In my repository, I have created tags using the following commands.

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

    How do you list all the tags in the repository?

    解决方案
    git tag
    

    should be enough. See git tag man page


    You also have:

    git tag -l <pattern>
    


    More recently ("How to sort git tags?", for Git 2.0+)

    git tag --sort=<type>
    


    That lists both:

    • annotated tags: full objects stored in the Git database. They’re checksummed; contain the tagger name, e-mail, and date; have a tagging message; and can be signed and verified with GNU Privacy Guard (GPG).
    • lightweight tags: simple pointer to an existing commit

    Note: the git ready article on tagging disapproves of lightweight tag.


    That being said, Charles Bailey points out that a 'git tag -m "..."' actually implies a proper (unsigned annotated) tag (option '-a'), and not a lightweight one. So you are good with your initial command.


    This differs from:

    git show-ref --tags -d
    

    Which lists tags with their commits (see "Git Tag list, display commit sha1 hashes").
    Note the -d in order to dereference the annotated tag object (which have their own commit SHA1) and display the actual tagged commit.

    Similarly, git show --name-only <aTag> would list the tag and associated commit.

    这篇关于如何列出所有Git标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 07-23 23:46