Skip to content

Instantly share code, notes, and snippets.

@nfekete
Last active August 30, 2018 03:09
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 nfekete/29c8c8042e9f021c94cbbf0e76f5c15a to your computer and use it in GitHub Desktop.
Save nfekete/29c8c8042e9f021c94cbbf0e76f5c15a to your computer and use it in GitHub Desktop.
#!/bin/bash
while [[ $# > 0 ]] ; do
case "$1" in
--not-in-head)
NOT_IN_HEAD=true
;;
esac
shift
done
git rev-list --objects --all \
| \
if [ -n "$NOT_IN_HEAD" ]; then
grep -vF --file=<(git ls-tree -r HEAD | awk '{print $3}')
else
cat
fi \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| sed -n 's/^blob //p' \
| sort --numeric-sort --key=2 \
| cut -c 1-12,41- \
| 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