From a08d7d36a85222bcbae68457b91bc5da7da509cd Mon Sep 17 00:00:00 2001 From: Igor Khomyakov Date: Thu, 1 Mar 2012 12:50:03 -0500 Subject: [PATCH] find large files in a git repo --- git/git-find-large | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 git/git-find-large diff --git a/git/git-find-large b/git/git-find-large new file mode 100755 index 0000000..80dfcdc --- /dev/null +++ b/git/git-find-large @@ -0,0 +1,28 @@ +#!/bin/sh +# +# From http://mid.gmane.org/20090710114316.GA6880@atjola.homenet +# + +usage() { + echo "usage: `basename $0` []" + 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 + -- 2.11.4.GIT