summaryrefslogtreecommitdiff
path: root/tech/clear up a large git folder.txt
blob: 1003a5f399f57f36506568b85afa66a65b8974c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
To clean up a large .git folder, first see what the giant files are by running this command:

git verify-pack -v .git/objects/pack/pack-9987666e7a6a7ebb5abde337ba017dcf67534986.idx | sort -k 3 -n | tail -10

That will get a list of blogs, you can then run:

git rev-list --objects --all | grep  <first few chars of blok>

to see what the actual files are that are taking up so much space.

Assuming you want to get rid of the large files and clear that space, you can do that like this (assume you want to get rid of a bunch of .mov files):

git filter-branch --index-filter 'git rm --cached --ignore-unmatch *.mov' -- --all
rm -Rf .git/refs/original
rm -Rf .git/logs/
git gc --aggressive --prune=now