diff --git a/large-files b/large-files new file mode 100755 index 0000000..0403927 --- /dev/null +++ b/large-files @@ -0,0 +1,61 @@ +#!/bin/bash + +set -e + +# Function to display help message +usage() { + cat </dev/null 2>&1; then + echo "Error: Not inside a Git repository." + exit 1 +fi + +echo "🔍 Finding the $NUM_FILES largest files in the repository..." + +# Extract large files from Git history +git rev-list --objects --all | + git cat-file --batch-check='%(objectsize:disk) %(rest)' | + sort -rh | + head -n "$NUM_FILES" | + awk '{ printf "%10s %s\n", $1, $2 }' | + numfmt --to=iec-i --suffix=B --padding=7 --field=1 + +echo "✅ Done!"