remote tag not shown in local

user_stackoverflow picture user_stackoverflow · Jun 28, 2013 · Viewed 13.3k times · Source

I am new to using git and tags. My team member ran the following commands:

git tag v1.27.1
git push origin v1.27.1 

Now when I git pull and then run git tag in my environment, I expect to see a list of all the tags. I can see other tags that were pushed to repo in the similar way, but not this particular one. I want to find out how/where did this tag get lost. How can I do this? What should be my approach?

Also, my team member who created the tag can see the tag on his machine when he runs git tag Thanks!

Answer

John Szakmeister picture John Szakmeister · Jun 28, 2013

Unfortunately, git pull doesn't fetch tags by default. You need to run git fetch --tags, and then you'll have them.

The default behavior of git pull and git fetch is to only retrieve tags that are directly accessible by the current references. If any tags are not, then those are not fetched. Passing --tags to git fetch tells git that you want them all, whether they're reachable by current references or not.