Created
May 21, 2010 07:12
-
-
Save steingrd/408569 to your computer and use it in GitHub Desktop.
Find large objects in a Git repo
This file contains hidden or 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
#!/bin/sh | |
# | |
# From http://mid.gmane.org/[email protected] | |
# | |
usage() { | |
echo "usage: `basename $0` [<limit>]" | |
exit 1 | |
} | |
limit=10 | |
if test $# -gt 1 | |
then | |
usage | |
elif test $# -eq 1 | |
then | |
limit=$1 | |
fi | |
git rev-list --all --objects | | |
sed -n $(git rev-list --objects --all | | |
cut -f1 -d' ' | git cat-file --batch-check | grep blob | | |
sort -n -k3 | tail -n$limit | while read hash type size; | |
do | |
echo -n "-e s/$hash/$size/p "; | |
done) | | |
sort -n -k1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment