Skip to content

Instantly share code, notes, and snippets.

@spdin
Created February 20, 2020 04:24
Show Gist options
  • Save spdin/ff6f151dda1845037779f8d592dda0f5 to your computer and use it in GitHub Desktop.
Save spdin/ff6f151dda1845037779f8d592dda0f5 to your computer and use it in GitHub Desktop.
# https://rtyley.github.io/bfg-repo-cleaner/
# check pack size
git count-objects -v -H
# download bfg and move to directory, rename to bfg
wget https://repo1.maven.org/maven2/com/madgag/bfg/1.13.0/bfg-1.13.0.jar
# clone mirror
git clone --mirror git://example.com/some-big-repo.git
# remove big files
java -jar bfg.jar --strip-blobs-bigger-than 100M some-big-repo.git
# remove specific file with extension
bfg --delete-files <fileName.extension> <git repo name>.git
# example
java -jar bfg.jar --delete-files *.jpg <git repo name>.git
# enter git folder
cd some-big-repo.git
git reflog expire --expire=now --all && git gc --prune=now --aggressive
# push
git push
# or
git push --force
# check again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment