Skip to content

Instantly share code, notes, and snippets.

@ksindi
Last active February 23, 2024 15:12
Show Gist options
  • Save ksindi/2aa0d5586b6eb3ae3e3847231d825897 to your computer and use it in GitHub Desktop.
Save ksindi/2aa0d5586b6eb3ae3e3847231d825897 to your computer and use it in GitHub Desktop.
Versioned files in human readable format sorted by size
git ls-tree -rz --name-only HEAD -- | xargs -0 du -kh | sort -sh -k 1,1
@ksindi
Copy link
Author

ksindi commented Jul 30, 2017

Get the total repo size:

git ls-tree -rz --name-only HEAD -- | xargs -0 ls -l | awk '{ sum += $5; } END { print sum; } ' | numfmt --to=si

@ksindi
Copy link
Author

ksindi commented Jul 30, 2017

git ls-tree -rz --name-only HEAD -- | xargs -0 du -k | awk '{ sum += $1; } END { print sum; } ' | numfmt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment