Created
May 22, 2013 01:27
-
-
Save jennings/5624621 to your computer and use it in GitHub Desktop.
Lists all objects in a Git database and lists them in descending order of size.
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
# From: http://naleid.com/blog/2012/01/17/finding-and-purging-big-files-from-git-history/ | |
git rev-list --objects --all | sort -k 2 > allfileshas.txt | |
git gc && git verify-pack -v .git/objects/pack/pack-*.idx | egrep "^\w+ blob\W+[0-9]+ [0-9]+ [0-9]+$" | sort -k 3 -n -r > bigobjects.txt | |
for SHA in `cut -f 1 -d\ < bigobjects.txt`; do | |
echo $(grep $SHA bigobjects.txt) $(grep $SHA allfileshas.txt) | awk '{one=$1; three=$3;$1=$2=$3=$4=$5=$6=""; print one,three,$0}' >> bigtosmall.txt | |
done; | |
# bigtosmall.txt now contains the sizes of all Git objects |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment