Skip to content

Instantly share code, notes, and snippets.

@chadly
Last active May 17, 2018 13:39
Show Gist options
  • Save chadly/387d64f4005b1943cc327e6319fdd513 to your computer and use it in GitHub Desktop.
Save chadly/387d64f4005b1943cc327e6319fdd513 to your computer and use it in GitHub Desktop.
Delete prerelease git tags
#!/bin/bash
#this will delete tags that look like v7.1.0-adj-policy-update-ex.1+56
git tag -l | awk '/^(v.*-.*)$/ {print $1}' | xargs git tag -d
git ls-remote --tags origin | awk '/^(.*)(\s+)(.*v.+-)[^\^]+$/ {print ":" $2}' | xargs git push origin
# add back specific pre-release tags you want to keep
git tag v7.9.3-no-go-reason.1+5 a88ae0b7fdd9d76ccae35df6a96f43248a100ff6
# push those specific tags back to origin
git tag -l | awk '/^(v.*-.*)$/ {print $1}' | xargs git push origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment