把这个贴在TLDR人群上,都归功于torek的出色回答。
我运行了这个程序(在WindowsMingW64 GitCLI上,引用/转义在其他终端上可能有所不同),查看了它,然后运行了它输出的所有命令。
git for-each-ref --contains <root_commit_hash> --format="%(refname:short)" refs/tags | xargs -I % echo git tag -d % \&\& git push --delete origin %
加一些
git gc
和/或
git prune
好办法。