【问题标题】:Browse list of tagged releases in a repo?浏览 repo 中的标记版本列表?
【发布时间】:2015-04-26 19:12:49
【问题描述】:

我正在尝试检查 OpenSSL 1.0.2a(而不是 Master)。 OpenSSL 已标记发布,我正在尝试浏览它们以确定实际名称是什么。我知道它们有 1.0.0、1.0.1 和 1.0.2(但它们的命名更复杂)。

根据OpenSSL Git repository,repo 位于 git://git.openssl.org/openssl.git。

根据How to see all tags in a git repository in command line,我需要使用git tag

$ git tag git://git.openssl.org/openssl.git
fatal: Not a git repository (or any of the parent directories): .git

如何浏览 Git 存储库中的标记版本?


为了完整起见,Git for beginners: The definitive practical guide 不讨论这个话题。

【问题讨论】:

    标签: git


    【解决方案1】:

    git tag 假设您有一个在本地签出的 repo 的克隆。 (这就是为什么它抱怨不在 git 存储库中的原因。)

    要实现你想要的,你可能想先克隆它,然后切换到所需的标签:

    git clone git://git.openssl.org/openssl.git
    cd openssl
    git tag -l                   # to list the tags
    git checkout tags/<name>     # to switch to the desired tag
    

    您还可以使用以下命令获取远程存储库中的标签列表,而无需先执行git clone

    git ls-remote --tags git://git.openssl.org/openssl.git
    

    【讨论】:

    • 完美,非常感谢。我不知道有这样的区别。
    • “你可能想先克隆它,然后切换到所需的标签” - 实际上,它是相反的。一旦我确定了我想要的分支,我将检查分支而不是 Master。大师在我要进行更改的特定领域有很大不同。
    • @jww clonecheckout 是两个不同的东西。虽然可以克隆存储库并仅获取所有分支的特定子集,但克隆整个存储库并签出您感兴趣的任何分支要容易得多。
    • git tags 对我不起作用。应该是git tag
    猜你喜欢
    • 2015-02-06
    • 1970-01-01
    • 1970-01-01
    • 2015-08-15
    • 1970-01-01
    • 1970-01-01
    • 2018-09-14
    • 1970-01-01
    • 2020-12-14
    相关资源
    最近更新 更多