Skip to content

Instantly share code, notes, and snippets.

@nathanl
nathanl / git_tag_cleanup.rb
Created January 20, 2012 16:10
Clean up tags in a git repository
# Script to delete all but a specified list of tags
# from a git repo, both locally and remotely
# Run like `mode=test ruby git_tag_cleanup` to test;
# use 'execute' mode to actually delete the tags
mode = ENV['mode'] || 'test'
tags_to_keep = %w[v2.0.0 v2.0.1]
tags_to_delete = `git tag`.split("\n") - tags_to_keep