1 2 3 4
#!/bin/sh REFS=$(cat .git/refs/*/*) [ "$REFS" ] || exit 1 git-fsck-cache --unreachable $REFS | grep unreachable | cut -d' ' -f3 | sed 's:^\(..\):.git/objects/\1/:' | xargs -r rm