feat(git): add git-largest-objects helper

This commit is contained in:
2023-03-09 23:24:39 +00:00
parent 6e3154deba
commit 08c8ac784d
2 changed files with 14 additions and 0 deletions

13
zsh/git.zsh Normal file
View File

@@ -0,0 +1,13 @@
#
# git
#
# Stolen from: https://stackoverflow.com/a/42544963
git-largest-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
}