Skip to content

Instantly share code, notes, and snippets.

@RosanaRufer
Forked from arzzen/git-delete-old-tags
Created May 3, 2020 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RosanaRufer/a95743e87ac419ff2afccee7fb525fc3 to your computer and use it in GitHub Desktop.
Save RosanaRufer/a95743e87ac419ff2afccee7fb525fc3 to your computer and use it in GitHub Desktop.
#!/bin/bash
count=`git tag -l | wc -l`
keep=20
num=0
for t in `git tag -l --sort=taggerdate`
do
if [ "$num" -ge `expr $count - $keep` ]
then
break
fi
git push origin :$t
git tag -d $t
num=`expr $num + 1`
echo "[$num] Removed $t"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment