Skip to content

Instantly share code, notes, and snippets.

@workmanw
Created November 13, 2012 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save workmanw/4063343 to your computer and use it in GitHub Desktop.
Save workmanw/4063343 to your computer and use it in GitHub Desktop.
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