Removing old deployment tags from your repository
Thursday, June 27, 2013 at 09:44PM
John Carney in Software Development, bash, capistrano, deployment, git, tags

At work we use the capistrano-deploytags gem to tag deployments. The idea is to make it easier to cut hot fix branches should the need ever arise. The problem with this is that you end up with a great big pile of tags in your repo.

I don't know if there is any actual downside to having a huge number of repo tags, but it does clutter up the view in graphical git clients such as Tower or SourceTree. So I wanted a way to delete old tags.

Turns out git itself doesn't provide a way to build delete tags, so I came up with this little bit of shell script to do it. It uses egrep to select the tags to delete then removes each in turn.

Change the egrep pattern to match the tags you want to keep.

Article originally appeared on the inner curmudgeon (
See website for complete article licensing information.