Skip to content

Instantly share code, notes, and snippets.

@workmanw
Created November 13, 2012 01:42
Embed
What would you like to do?
Finding the biggest files in a git repo
#!/bin/bash
IFS=$'\n'
for F in `git verify-pack -v .git/objects/pack/pack-*.idx | sort -k 3 -n | tail -10 | tail -r`; do
echo $F;
HASHKEY=`echo $F | cut -c 1-40`
FILEPATH=`git rev-list --objects --all | grep $HASHKEY | cut -c 42-128`
FILESIZE=`echo $F | cut -f 5 -d ' '`
FILESIZEHR=`echo "scale=2;$FILESIZE/1024/1024" | bc`
printf "\t $FILEPATH ($FILESIZEHR MB)\n\n";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment