Last Updated: February 25, 2016
·
3.998K
· yitsushi

git-remove-tag: Remove tags from local and remote

Our repository is garbage with a lot of version tags because our system works with signed tags. Our release script deploy the latest signed tag from master.

This is a small shell function to remove the tag from local and then the remote repository:

function git-remove-tag {
  if [[ -z $2 ]]; then remote="origin"; else remote=$2; fi
  git tag -d $1; git push $remote :refs/tags/$1
}

Now I can remove all really-urgent-bugfix-for-delivery version tags:

for v in `git tag | grep "\d.\d.\d.\d"`; do git-remove-tag $v bucket; done