The blog has moved to http://jessehouse.com/ ... Many google searches point here so I am leaving it operational, but there will be no new posts.

Wednesday, October 31, 2012

Helper script to delete git tags locally and remote

Might be useful to others, delete a bunch of git tags - remote and locally


### matches all git tags that start with numeric value, update regex as needed
# commands to remove local tags
git tag -l | grep "^\d" | sed 's/^/tag -d /' > _remove_tags
# commands to remove remote tags
git tag -l | grep "^\d" | sed 's/^/push origin :refs\/tags\//' > _remove_tags_remote
# review contents of file
cat _remove_tags | while read line; do echo $line; done
# execute each line in file
cat _remove_tags | while read line; do git $line; done
# review contents of file
cat _remove_tags_remote | while read line; do echo $line; done
# execute each line in file
cat _remove_tags_remote | while read line; do git $line; done

Resources