Search code examples
gitgit-tag

Delete all tags from a Git repository


I want to delete all the tags from a Git repository. How can I do that?

Using git tag -d tagname delete the tag tagname locally, and using git push --tags I update the tags on the git provider.

I tried:

git tag -d *

But I see that * means the files from the current directory.

$ git tag -d *
error: tag 'file1' not found.
error: tag 'file2' not found.
...

Consider I have a lot of tags, and I want to delete them, all.


Solution

  • git tag | xargs git tag -d
    

    Simply follow the Unix philosophy where you pipe everything.

    On Windows use git bash with the same command.