Created
April 1, 2011 20:29
-
-
Save matthewmccullough/898798 to your computer and use it in GitHub Desktop.
Script to delete all tags both locally and remotely
We use bitbucket to host our git repo, and the commands above didn't work. This one did:
for tag in `git tag -l`
do
git tag -d $tag
git push -v origin :refs/tags/$tag
done
Very useful for cleaning up after testing some CI tools.
git tag -l | xargs -n 1 git push --delete origin
fatal: --delete doesn't make sense without any refs
@jmrobison, thanks, worked!
For the issue with --delete doesn't make sense without any refs
here's how I delete all the tags for 1.3.* :
git ls-remote --tags origin | awk '/^(.*)(1\.3\.\d+)$/ {print ":" $2}' | xargs git push origin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mauris that Gist is a 404 now.
For anybody looking for a Windows version, I created a Gist below with the commands I used to remove all Tags on Windows. The Linux command
xargs
would not work. I would get anxargs: cannot fork: Permission denied
error. Figured out I need to use theFOR
command in Windows.https://gist.github.com/RandomArray/fdaa427878952d9768b0