Created
February 1, 2020 23:25
-
-
Save c-l-nguyen/eb16bf1d109e1567c0e7ec6cd9e8c453 to your computer and use it in GitHub Desktop.
clean large repo
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
# 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