Created
March 8, 2014 03:12
-
Star
(336)
You must be signed in to star a gist -
Fork
(76)
You must be signed in to fork a gist
-
-
Save okunishinishi/9424779 to your computer and use it in GitHub Desktop.
Delete all git remote tags
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This variant, inspired by @markusressel, deletes all tags from a remote Git repository in a single push using
xargs, making it faster and cleaner than deleting them individually.Script:
How it works:
REMOTE_NAME=origin→ sets the remote name.git ls-remote --tags "$REMOTE_NAME"→ lists all remote tags, with each line showing<SHA> <refname>.awk '{print $2}'→ extracts the refname (e.g.,refs/tags/v1.0.0).grep -v '\^{}$'→ removes dereferenced annotated tags ending with^{}.xargs -r git push --delete "$REMOTE_NAME"→ deletes remaining tags in a single push.