I have over time archived a bunch of build tags in refs/builds/archived/*
and I now want to delete them to recover some space and reduce total object count (over 50k annotated git tags are stored there).
It would appear that the only way to do this is like so:
git show-ref\
| awk '/refs\/builds\/archived\/[^\/]*$/ { print "git update-ref -d "$2}'\
| sh
This is extremely slow. Also, doing this appears to slow down any git fetches done from the repo until I get to run git gc
on it.
You should be able to say something like
git for-each-ref --format='delete %(refname)' refs/builds/archived | git update-ref --stdin
This should do the whole thing in one bulk operation. Note that I haven't actually tried this myself.