Created
August 16, 2023 09:01
-
-
Save mt3o/1ab0cfa53c2ed0ee26c25797b55f6376 to your computer and use it in GitHub Desktop.
Diagnose & remove large files from git 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 large objects | |
git rev-list --objects --all | | |
git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | | |
sed -n 's/^blob //p' | | |
sort --numeric-sort --key=2 | | |
cut -c 1-12,41- | | |
$(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest | |
# remove package.tar.xz from repo | |
git filter-branch --index-filter 'rm -f package.tar.xz' -- --all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment