Skip to content

Instantly share code, notes, and snippets.

@steventux
Created July 24, 2018 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steventux/f3484713c340252e049c6159b02d08ea to your computer and use it in GitHub Desktop.
Save steventux/f3484713c340252e049c6159b02d08ea to your computer and use it in GitHub Desktop.
List the largest git repo objects
#!/bin/bash
git_dir=$1
cd $git_dir && git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort --numeric-sort --key=2 | cut -c 1-12,41- | numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest | awk '$2 >= 2^20'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment