Snippets

Erik van Zijst Find large files across all branches in a Git repo

Created by Erik van Zijst last modified
#!/usr/bin/env bash
#
# Finds and prints the largest 10 files on each branch.

git for-each-ref --shell --format 'ref=%(refname)' refs/heads | \
while read line
do
    eval "$line"
    echo "***" $ref && ( git ls-tree -r -l $ref | sort -n -k 4 -r | head; echo '' )
done

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.