git - Bitbucket 上未出现推送标签

标签 git bitbucket

我用命令创建了一个新标签 git tag -a v1.0 -m“生产版本”

并通过git push origin v1.0将标签推送到远程

成功,我得到了以下响应。

Counting objects: 3, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 662 bytes | 662.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://bitbucket.org/project/repo.git
 * [new tag]         v1.0 -> v1.0

但是当我浏览 Bitbucket 提交时,我仍然看不到这个标签。 它应该显示在最后一次提交的旁边。 我是否缺少任何步骤?

最佳答案

设置标签后检查您的 git 状态:您可能处于 detached HEAD mode 中.

这可以解释为什么分支的最后一次提交(而不是分离的 HEAD 中的任何提交)不会收到标记。


OP jinil-cs添加in the comments :

As you suggested, git status showed me

Your branch is ahead of 'origin/master' by 2 commits. 

这不是分离的 HEAD 情况,而是指出您在分支 HEAD 上看不到标签的另一个原因:您尚未推送分支。

I did git reset --hard origin/master since I don't need my local changes.

好吧,这有点危险,因为其他人可能会使他们的最后一次提交不可见(仍然在 git reflog 中),但在你的情况下,这会起作用。

Then I deleted the remote and local tags.

git push --delete origin v1.0 
  git tag -d v1.0 

Created the same tag and pushed it again!


我在 April 2013 the Git 1.8.3 push option --follow-tags 中提到过,由 Daemon Painter 建议,这确实会推送非推送提交新标签,使其对您的远程分支 HEAD 可见。

但是由于您不需要推送本地提交,因此您的解决方案仍然有效。

再次强调:用于检查本地情况的 git status 仍然是了解本地完成的操作与远程可见的操作之间的差异的良好第一步。

关于git - Bitbucket 上未出现推送标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61627867/

相关文章:

git - 如何从 HTTPS 迁移到 SSH github

git - 是否可以在 gitk 中通过提交哈希进行搜索?

git - 修补程序后 merge Git Flow 功能分支?

混帐 : Ubuntu: Url has no scheme

heroku - bitbucket 管道到 heroku 身份验证失败

bitbucket - 如何获取BitBucket分支url?

访问bitbucket存储库多个 key 时git ssh授权错误

git - 在本地与卡在 pull 请求中的本地分支远程工作

windows - 同一台机器上的多个 Bitbucket SSH 帐户

git - 通过ssh克隆Bitbucket存储库