Instantly share code, notes, and snippets.

Embed
What would you like to do?
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@Graham-72

This comment has been minimized.

Copy link

Graham-72 commented Mar 15, 2015

When I tried this from Git Bash on my Windows PC, line 6 was requiring me to log back in to GitHub for each tag. Is there some way to delete all the tags as a batch?

@Graham-72

This comment has been minimized.

Copy link

Graham-72 commented Mar 15, 2015

I have found the answer to my question - set up Git Bash credentials as follows:
Enter username and email with
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR EMAIL ADDRESS"

Then use credential helper with
git config --global credential.helper wincred
git config --global credential.helper store

This last line stores password for use by Git Bash each time one is requested.

@robertmhaas

This comment has been minimized.

Copy link

robertmhaas commented Jun 9, 2015

The "-n 1" in the example above does not seem to be necessary, and removing it makes this much faster.

@wickdninja

This comment has been minimized.

Copy link

wickdninja commented Mar 22, 2017

Confirmed removing -n 1 deletes all tags as a batch which is much faster.

@KSXGitHub

This comment has been minimized.

Copy link

KSXGitHub commented Apr 13, 2017

What about this?

#Delete local tags.
git tag -d $(git tag -l)
#Fetch remote tags.
git fetch
#Delete remote tags.
git push origin --delete $(git tag -l) # Pushing once should be faster than multiple times
#Delete local tags.
git tag -d $(git tag -l)
@noxify

This comment has been minimized.

Copy link

noxify commented May 1, 2017

Works perfect @KSXGitHub

@keesdewit82

This comment has been minimized.

Copy link

keesdewit82 commented Jul 10, 2017

@KSXGitHub works very well!

@wyt

This comment has been minimized.

Copy link

wyt commented Jun 6, 2018

nice.

@ehimsi

This comment has been minimized.

Copy link

ehimsi commented Jun 13, 2018

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment