Reputation: 157
I have deleted some tags by running:
git tag -d TAGNAME
git push origin :refs/tags/TAGNAME
After that I asked all team members to run:
git tag -d $(git tag)
- to remove all local tagsgit fetch --tags
- to retrieve current tags from remote.The problem is that now and then I see the old tags appearing again. I suspect that someone still has a few old tags and didn't delete them or pulled before I deleted or so.
Is there a way to completely delete a tag?
For example - to make a commit that deletes old tags and so before users will be able to push they will have to pull that commit and so it will change their tags. Is that possible?
Upvotes: 14
Views: 3220
Reputation: 101
The solution from @eckes did not work for me; what did work was this answer from Joseph K Strauss:
https://stackoverflow.com/a/30782368/15382340
git fetch origin refs/tags/*:refs/tags/* --prune
Upvotes: 8
Reputation: 67137
When you delete remote branches, you have to git remote prune origin
in order to completely remove these deleted branches from the working copy.
Since tags are quite much the same as branches, I assume you need to prune here too.
git fetch
also knows the --prune
parameter, so either
git remote prune origin
or
git fetch --prune
should do the trick.
This is an additional safety measure: fetch
only updates known remote branches and introduces new ones but never deletes them unless --prune
is requested.
Upvotes: 8