Skip to content

Instantly share code, notes, and snippets.

@nexus166
Created June 25, 2019 13:03
Show Gist options
  • Select an option

  • Save nexus166/b922387045012472f159c4d68cf895d8 to your computer and use it in GitHub Desktop.

Select an option

Save nexus166/b922387045012472f159c4d68cf895d8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# https://stackoverflow.com/a/42544963
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment