Skip to content

Instantly share code, notes, and snippets.

@waleedsamy
Created July 3, 2017 13:55
Show Gist options
  • Save waleedsamy/5d72073658b029e93f0081f7b358a294 to your computer and use it in GitHub Desktop.
Save waleedsamy/5d72073658b029e93f0081f7b358a294 to your computer and use it in GitHub Desktop.
find which files have the biggest size in git repo
# https://stackoverflow.com/a/42544963/5318264
brew install coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt
git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| awk '/^blob/ {print substr($0,6)}' \
| sort --numeric-sort --key=2 \
| gcut --complement --characters=8-40 \
| gnumfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment