Skip to content

Instantly share code, notes, and snippets.

@shsteimer
Created October 31, 2013 21:10
Show Gist options
  • Save shsteimer/7257245 to your computer and use it in GitHub Desktop.
Save shsteimer/7257245 to your computer and use it in GitHub Desktop.
Tip to delete tags by pattern
#delete all the remote tags with the pattern your looking for, ie. DEV-
git tag | grep <pattern> | xargs -n 1 -i% git push origin :refs/tags/%
#delete all your local tags
git tag | xargs -n 1 -i% git tag -d %
#fetch the remote tags which still remain
git fetch
@leoniralves
Copy link

Thanks @kerryj89. This worked fine on macOS! 👏

@githubtotusharTMA2
Copy link

You can try this. It will delete all matching tag patterns. E.g. for deleting tags starting with v1.0, use git tag -d $(git tag -l "v1.0*")

Delete remote: git push -d $(git tag -l "tag_prefix*") Delete local: git tag -d $(git tag -l "tag_prefix*")

Thank You @chinmaya-kony & @luwes.
Thank You All for the help🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment