Skip to content

Instantly share code, notes, and snippets.

@c-l-nguyen
Created February 1, 2020 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c-l-nguyen/eb16bf1d109e1567c0e7ec6cd9e8c453 to your computer and use it in GitHub Desktop.
Save c-l-nguyen/eb16bf1d109e1567c0e7ec6cd9e8c453 to your computer and use it in GitHub Desktop.
clean large repo
# find top 10 largest files
git rev-list --objects --all | grep -f <(git verify-pack -v .git/objects/pack/*.idx| sort -k 3 -n | cut -f 1 -d " " | tail -10)
# clean repo
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
# push changes
git push -f origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment