Last active
August 3, 2016 17:15
-
-
Save superboum/90e3be176086102576367cd08e0ac7c4 to your computer and use it in GitHub Desktop.
Git helpers
This file contains 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
# Based on: | |
# http://stackoverflow.com/questions/1029969/why-is-my-git-repository-so-big | |
git rev-list --all --objects | \ | |
sed -n $(git rev-list --objects --all | \ | |
cut -f1 -d' ' | \ | |
git cat-file --batch-check | \ | |
grep blob | \ | |
sort -n -k 3 | \ | |
tail -n200 | \ | |
while read hash type size; do | |
echo -n "-e s/$hash/$size/p "; | |
done) | \ | |
sort -n -k1 | \ | |
while read size name; do | |
echo "$(numfmt $size --to=iec-i --suffix=o) $name" | |
done |
This file contains 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 lfs ls-files | \ | |
while read commit star path | |
do | |
size=`ls -l $path 2> /dev/null |cut -d " " -f5 2> /dev/null` | |
echo "$size $path" | |
done | \ | |
sort -n -k1 | \ | |
while read size name; do | |
echo "$(numfmt $size --to=iec-i --suffix=o 2> /dev/null) $name" | |
done |
This file contains 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
# Usage: ./git-fatfiles.sh | ./sort-by-extension.sh | |
sed -r 's/^.*\.([a-zA-Z0-9]+)$/\1/' | sort | uniq -c | sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment