How to remove all git origin and local tags?

How do you remove a git tag that has already been pushed? Delete all git remote (origin) tags and Delete all git local tags.


Solution 1:

  1. Delete All local tags. (Optional Recommended)

    git tag -d $(git tag -l)
    
  2. Fetch remote All tags. (Optional Recommended)

    git fetch
    
  3. Delete All remote tags.

    git push origin --delete $(git tag -l) # Pushing once should be faster than multiple times
    
  4. Delete All local tags.

    git tag -d $(git tag -l)
    

Solution 2:

For windows using command prompt:

Deleting local tags:

for /f "tokens=* delims=" %a in ('git tag -l') do git tag -d %a

Deleting remote tags:

for /f "tokens=* delims=" %a in ('git tag -l') do git push --delete origin %a