Skip to content

Instantly share code, notes, and snippets.

@lfbittencourt
Last active March 21, 2017 11:03
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save lfbittencourt/febbfa92b61dfe76075e to your computer and use it in GitHub Desktop.
Save lfbittencourt/febbfa92b61dfe76075e to your computer and use it in GitHub Desktop.
This Ruby script removes all local and remote tags in a single-line way, so you don't need supply your credentials several times. Optionally, you can remove only tags greater than a specific version.
#!/usr/bin/env ruby
# Only tags >= min_tag will be removed.
min_tag = '0.0.0'
tags = `git tag`.split(/\s+/).select do |t|
Gem::Version.new(t) >= Gem::Version.new(min_tag)
end
`git tag -d #{tags.join ' '}`
`git push origin #{tags.map { |t| ':' + t }.join ' '}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment