Skip to content

Instantly share code, notes, and snippets.

@grachevko
Forked from BBBSnowball/git-find-big-commit.sh
Created October 17, 2019 10:02
Show Gist options
  • Save grachevko/42926797467a2016a8e29ab6f9c438ba to your computer and use it in GitHub Desktop.
Save grachevko/42926797467a2016a8e29ab6f9c438ba to your computer and use it in GitHub Desktop.
Find big commits in git
#!/bin/sh
# http://stackoverflow.com/a/1557398
for sha in $(git rev-list --all --pretty=format:"" | sed "s/^commit //") ; do git diff-tree -r -c -M -C --no-commit-id $sha | awk '{print $4}' | git cat-file --batch-check 2>/dev/null | awk '{ sum+=$3 } END {printf "%010d %s\n", sum, "'"$sha"'"}' ; done | sort | tail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment