find large files in a git repo
[ikh.git] / git / git-find-large
blob80dfcdce16481e3ef78a81bfa6cc0e07e1742021
1 #!/bin/sh
3 # From http://mid.gmane.org/20090710114316.GA6880@atjola.homenet
6 usage() {
7 echo "usage: `basename $0` [<limit>]"
8 exit 1
11 limit=10
12 if test $# -gt 1
13 then
14 usage
15 elif test $# -eq 1
16 then
17 limit=$1
20 git rev-list --all --objects |
21 sed -n $(git rev-list --objects --all |
22 cut -f1 -d' ' | git cat-file --batch-check | grep blob |
23 sort -n -k3 | tail -n$limit | while read hash type size;
25 echo -n "-e s/$hash/$size/p ";
26 done) |
27 sort -n -k1