Reduce .git folder size
07 Jun 2017
To see the 10 biggest files, run this from the root directory:
$ git verify-pack -v .git/objects/pack/pack-7b03cc896f31b2441f3a791ef760bd28495697e6.idx \
| sort -k 3 -n \
| tail -10
To see what each file is, run this:
$ git rev-list --objects --all | grep [first few chars of the sha1 from previous output]
Rewrite all the commits:
$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch "Folder Name/*"' -- --all
$ rm -Rf .git/refs/original
$ rm -Rf .git/logs/
$ git gc --aggressive --prune=now
Then verify:
$ git count-objects -v
Reference: