Skip to content

Instantly share code, notes, and snippets.

@mccurdyc
Last active January 3, 2020 20:57
Show Gist options
  • Save mccurdyc/11edc66e870881ef91ba530c5cc208c3 to your computer and use it in GitHub Desktop.
Save mccurdyc/11edc66e870881ef91ba530c5cc208c3 to your computer and use it in GitHub Desktop.
Git clean repo
# https://rtyley.github.io/bfg-repo-cleaner/
# https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery#Removing-Objects
java -jar ~/Desktop/bfg-1.13.0.jar --strip-blobs-bigger-than 5M .
rm -Rf .git/refs/original
rm -Rf .git/logs/
git count-objects -v
git tag | grep -v ignorethis | xargs git push --delete origin
git tag | grep -v ignorethis | xargs git tag -d
git push --tags --force
git count-objects -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment