title: How to find the N largest files in a git repository?
body: <p>I wanted to find the 10 largest files in my repository. The script I came up with is as follows:</p>
  
  <pre><code>REP_HOME_DIR=&lt;top level git directory&gt;
  max_huge_files=10
  
  cd ${REP_HOME_DIR}
  git verify-pack -v ${REP_HOME_DIR}/.git/objects/pack/pack-*.idx | \
    grep blob | \
    sort -r -k 3 -n | \
    head -${max_huge_files} | \
    awk '{ system("printf \"%-80s \" `git rev-list --objects --all | grep " $1 " | cut -d\" \" -f2`"); printf "Size:%5d MB Size in pack file:%5d MB\n", $3/1048576,  $4/1048576; }'
  cd -
  </code></pre>
  
  <p>Is there a better/more elegant way to do the same?</p>
  
  <p>By "files" I mean the files that have been checked into the repository. </p>