Skip to content

Instantly share code, notes, and snippets.

@jorgemanrubia
Created August 2, 2011 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorgemanrubia/1120368 to your computer and use it in GitHub Desktop.
Save jorgemanrubia/1120368 to your computer and use it in GitHub Desktop.
Script to delete all the git tags from a repository (both local and remote). Take care, because it really does what it says :)
def delete_local_tags
`git tag`.split(/\n/).each do |tag|
%x{git tag -d #{tag}}
end
end
def delete_remote_tags
`git ls-remote --tags origin`.split(/\n/).each do |remote_tag_line|
remote_tag_line =~ /\/([^\/]*)$/
%x{git push origin :refs/tags/#{$1}}
end
end
delete_local_tags
delete_remote_tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment