gitbitbucket

Pushed tag is not coming up on Bitbucket


I have created a new tag with command git tag -a v1.0 -m "Production Release".

And pushed the tag to remote by git push origin v1.0

It was successful and I got the below response.

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

But still when I browse the Bitbucket commits, I cannot see this tag. It was supposed to be shown right next to the last commit. Am i missing any steps?


Solution

  • Check your git status when you have setup the tag: you might have been in a detached HEAD mode.

    That would explain why the last commit of a branch (as opposed to any commit in a detached HEAD) would not have received the tag.


    The OP jinil-cs adds in the comments:

    As you suggested, git status showed me

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

    That is not a detached HEAD situation, but point to the other reason you don't see a tag along a branch HEAD: you have not push your branch yet.

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

    OK, that is a bit dangerous, as others might make their last commits invisible (there are still in the git reflog), but in your case, that would work.

    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!


    I mentioned in April 2013 the Git 1.8.3 push option --follow-tags, suggested by Daemon Painter, which would indeed have pushed non-pushed commits and the new tag, making it visible to your remote branch HEAD.

    But since you did not need your local commits to be pushed, your solution is still valid.

    Again: a git status to check the situation locally remains a good first step to understand the discrepancy between what is done locally and visible remotely.