I'm trying to identify all the large files in my git repo history and came across this command posted here.
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
I've been trying to figure out how to run this in a fish shell on a mac (For mac, you need to brew install codeutils
to be able to run the last line). The error I'm getting is fish: Illegal command name '$(command -v gnumfmt || echo numfmt)'
. I tried removing the $
sign got the same error (without the dollar sign though).
I'm a pretty new fish shell user, so would love some help from more experienced users. For now, I'm just switching to bash to run the script but it would be nice not to have to do that.