Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you delete a git tag and propagate said delete through git pull to others?

Tags:

git

We're currently cleaning up our git repo at work due to a ridiculous amount of branches and tags that just aren't needed.

We've done the branches part, but the tags part is proving troublesome.

We deleted the branches on the remote, and asked our team to do a git pull --prune to remove said branches in their local repos.

The problem is, there doesn't seem to be a way to do this with tags. We can delete the tag remotely quite easily, but we can't get that change to propagate down to other local repos when we do a git pull, or gc, or remote prune.

Any ideas on how to do this?

Or will we just have to stop people from using git push --tags until they re-clone the repo?

like image 235
Stephen Melrose Avatar asked May 29 '12 13:05

Stephen Melrose


People also ask

How do I delete a tag in git?

To delete a local git tag simply run the "git tag" command with the -d option and tag name. To know the tag name you can run the "git tag" command with the -l option to list all tags, identify the tag you want to delete.

What happens when you delete a tag in git?

nothing. It will remain there, pointing to an invalid reference, until you remove it with git tag -d <tag> .

How do I delete tags?

Click on the tag in the example page or email. From the pop-up menu that displays after you click the tag, select Clear tag.


2 Answers

You can't. Tags deleted on the remote will not be locally deleted on pull/fetch/etc.

like image 106
ellotheth Avatar answered Oct 16 '22 08:10

ellotheth


In older versions of Git this seems to work fine:

git fetch --tags --prune

(But this no longer works as of Git version 1.9.0 or newer.)

like image 10
Daniel Doubleday Avatar answered Oct 16 '22 08:10

Daniel Doubleday