Skip to content

Instantly share code, notes, and snippets.

@WimObiwan
Last active May 4, 2016 08:12
Show Gist options
  • Save WimObiwan/09f61de3c662656e57a8925ff147db35 to your computer and use it in GitHub Desktop.
Save WimObiwan/09f61de3c662656e57a8925ff147db35 to your computer and use it in GitHub Desktop.
Show biggest files in a GIT repository
#!/bin/sh
# linux / cygwin
git rev-list --objects --all | sort -k 2 > /tmp/allfileshas.txt
git verify-pack -v .git/objects/pack/pack-*.idx | egrep "^\w+ blob\W+[0-9]+ [0-9]+ [0-9]+$" | sort -k 3 -n -r | head -25 > /tmp/bigobjects.txt
echo > /tmp/bigtosmall.txt
for SHA in `cut -f 1 -d\ < /tmp/bigobjects.txt`; do
#echo $(grep $SHA /tmp/bigobjects.txt) $(grep $SHA /tmp/allfileshas.txt) | awk '{print $1,$3,$7}' >> /tmp/bigtosmall.txt
echo $(grep $SHA /tmp/bigobjects.txt) $(grep $SHA /tmp/allfileshas.txt) | awk '{print $1,$3,substr($0,index($0,$7))}' >> /tmp/bigtosmall.txt
done;
cat /tmp/bigtosmall.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment