Last active
August 22, 2018 17:27
-
-
Save Lacrymology/dcbbbc41d1d56690cf35e9700976e963 to your computer and use it in GitHub Desktop.
Git alias to list files by size
This file contains hidden or 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
git config --global alias.list-sizes-2 '!f() { 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- | numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest ; } ; f' | |
## Here's the command divided, to make it more clear | |
# 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- | |
# | 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