Skip to content

Instantly share code, notes, and snippets.

@neara
Created August 12, 2015 13:41
Show Gist options
  • Select an option

  • Save neara/a130726aef25932471d2 to your computer and use it in GitHub Desktop.

Select an option

Save neara/a130726aef25932471d2 to your computer and use it in GitHub Desktop.
A short example of how to clean tags on remote and local repo.
#!/bin/bash
echo "Firing up git tag cleanup..."
echo "Getting all tags.."
counter=1
for t in `git tag`
do
if [ "$t" = "babette" ] || [ "$t" = "blah-HF-2" ]; then
echo "$t is a keeper"
else
echo "deleting tag: $t"
git tag -d $t
git push --delete origin $t
counter=`expr $counter + 1`
fi
done
echo "Removed $counter tags."
echo "DONE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment