Created
December 4, 2013 08:44
-
-
Save svenvarkel/7784293 to your computer and use it in GitHub Desktop.
This script finds the n largest files from your git repository.
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
#!/bin/sh | |
# | |
# Credits go to: http://article.gmane.org/gmane.comp.version-control.git/123050 | |
# | |
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