Skip to content

Instantly share code, notes, and snippets.

@phawxby
Forked from arzzen/git-delete-old-tags
Last active August 11, 2017 10:47
Show Gist options
  • Save phawxby/8fb3c29ac56d87e952c12e53187a0d65 to your computer and use it in GitHub Desktop.
Save phawxby/8fb3c29ac56d87e952c12e53187a0d65 to your computer and use it in GitHub Desktop.
#!/bin/bash
keep=20
num=0
for t in `git tag -l --sort=-taggerdate`
do
if [ $num > $keep ] then
git tag -d $t
echo "Removed $t"
((num++))
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment