【问题标题】:Using Git tags - can't pull new tags使用 Git 标签 - 无法提取新标签
【发布时间】:2016-06-12 00:02:22
【问题描述】:

我们有 2 个人试图在 bitbucket 上使用 git。开发人员正在使用简单的标签来跟踪所有提交 - 质量检查人员正试图根据标签提取新代码。

所以开发人员决定

git commit -v -am "($date) $comments"
git tag -a version-1 -m "($date) $comments"
git push --tags

质量检查人员做到了

  git clone <path> ; cd $dir
  git checkout tags/version-1

这是第一次需要的 - 但第二次 - 对于更新标签 - 它会给出错误消息。

第一次做质量检查

  • 签出成功并显示消息

    注意:检查 'tags/version-1'。

    You are in 'detached HEAD' state. You can look around, make experimental
    changes and commit them, and you can discard any commits you make in this
    state without impacting any branches by performing another checkout.
    
    If you want to create a new branch to retain commits you create, you may
    do so (now or later) by using -b with the checkout command again. Example:
    
      git checkout -b <new-branch-name>
    
    HEAD is now at 0c3514c... (02-28-2016) test comments
    

然后开发人员做了他的改变,然后做了

 git commit -v -am "($date) $comments"
 git tag -a version-2 -m "($date) $comments"
 git push --tags

它通过了 - 我们可以在 repo 上看到新标签 - 有变化。

QA 人员进行更改

 git checkout tags/version-2

错误信息是

error: pathspec 'tags/version-2' did not match any file(s) known to git.

但是

如果 QA 这样做

  git clone <path> ; cd $dir
  git checkout tags/version-2

效果很好!!! QA 人员如何使用开发人员检查的新标签更新同一个 git 主管?

【问题讨论】:

    标签: git bitbucket


    【解决方案1】:

    好的 - 在我浏览堆栈上的其他链接时找到了答案。

    首先确保标签在本地存在

    git fetch --tags
    

    然后通过运行检查标签

    git checkout tags/<tag_name>
    

    感谢Git - Checkout a remote tag when two remotes have the same tag name(第二个回答)

    【讨论】:

      【解决方案2】:

      使用git fetch 从远程仓库获取新标签。

      【讨论】:

        猜你喜欢
        • 2015-12-06
        • 1970-01-01
        • 1970-01-01
        • 2012-12-15
        • 2023-02-09
        • 1970-01-01
        • 2021-12-07
        • 2014-08-01
        • 2022-01-28
        相关资源
        最近更新 更多