Over a million developers have joined DZone.

Deleting git Tags on a Remote

· Java Zone

Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.

For some reason our git repo for Apache Isis (mirrored on github) acquired a bunch of tags in the form:

  • upstream/isis-1.4.0
  • upstream/upstream/isis-1.4.0
  • upstream/upstream/upstream/isis-1.4.0
  • upstream/upstream/upstream/upstream/isis-1.4.0

Clearly something or someone has been accidentally pushing bad tags.

To remove these tags locally, I used:

for a in `git tag -l upstream*`; do echo $a; git tag -d $a ; done

To remove these tags from origin, I chose to do it in two steps. First locate the tags to be deleted:

git ls-remote –tags origin | awk ‘{print $2}’ | \
grep ^refs/tags/ | cut -c11- | \
grep upstream | grep -v "\^{}" \
> /tmp/y

then delete ‘em:

for a in `cat /tmp/y`; do echo $a; git push –delete origin $a ; done

The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!

Topics:

Published at DZone with permission of Dan Haywood, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}