Last active
April 22, 2017 12:11
-
-
Save ke4roh/d69315857293e409835e21344e3484b8 to your computer and use it in GitHub Desktop.
Show large objects in the git repo for cleaning cruft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat git-show-big | |
#!/bin/bash | |
# Ref http://naleid.com/blog/2012/01/17/finding-and-purging-big-files-from-git-history | |
SHAS=$(git rev-list --objects --all | sort -k 2) | |
BIGOBJS=$(git gc && git verify-pack -v .git/objects/pack/pack-*.idx | egrep "^\w+ blob\W+[0-9]+ [0-9]+ [0-9]+$" | sort -k 3 -n -r) | |
join <(echo "$BIGOBJS" | sort ) <(echo "$SHAS" | sort ) | sort -k 3 -n -r | cut -f 1,3,6- -d\ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment