Skip to content

Instantly share code, notes, and snippets.

@alanmackenzie
Last active August 29, 2015 14:05
Show Gist options
  • Save alanmackenzie/b07d31704e204af7b970 to your computer and use it in GitHub Desktop.
Save alanmackenzie/b07d31704e204af7b970 to your computer and use it in GitHub Desktop.
Delete git branches or tags based on string matching.
# Example: ./delete-git-branch-and-tags.sh sprint
# @TODO: Handle multiple remote repositorys.
SEARCH="${1}"
for i in $(git tag | grep "${SEARCH}");
do
git tag -d "${i}"
git push origin ":refs/tags/${i}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment