Created
October 30, 2017 20:25
-
-
Save mandarjog/e906c24135024a1393259855280e0883 to your computer and use it in GitHub Desktop.
Reduce Git Repo Size -- destructive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BFG_URL=http://repo1.maven.org/maven2/com/madgag/bfg/1.12.16/bfg-1.12.16.jar | |
DIR=$(mktemp -d) | |
echo $DIR | |
cd $DIR | |
curl $BFG_URL -o bfg.jar | |
git clone --mirror git@github.com:istio/istio.git | |
# All istioctl-* binaries are bigger than this. | |
java -jar bfg.jar --strip-blobs-bigger-than 2M istio.git | |
cd istio.git | |
# show current size | |
echo "Size before cleanup" | |
git count-objects -v | |
# cleanup space | |
git reflog expire --expire=now --all | |
git gc --prune=now --aggressive | |
echo "Size after cleanup" | |
git count-objects -v | |
echo "cd $DIR/istio.git" | |
echo "Run git push if cleaned up files look ok" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment