Skip to content

Instantly share code, notes, and snippets.

@ngbrown
Created March 4, 2026 00:53
Show Gist options
  • Select an option

  • Save ngbrown/27d98089a88fd2d04d6d9495c578fe3f to your computer and use it in GitHub Desktop.

Select an option

Save ngbrown/27d98089a88fd2d04d6d9495c578fe3f to your computer and use it in GitHub Desktop.
Find commits with large modified files, for example because of formatting
#!/usr/bin/env bash
git log --pretty=format:"%H - %ad :" --date=format:"%a %b %d %T %Y %z" | while read line; do commit_hash=$(echo $line | cut -d' ' -f1); commit_date=$(echo $line | cut -d' ' -f3-); commit_size=$(git show --format=format: --stat $commit_hash --diff-filter=M -- . ':!**/package-lock.json' ':!**/*.Generated.cs' ':!**/*_.pb.ts' ':!**/*.Designer.*' | tail -1 | awk '{print $4}'); echo "$commit_date 0$commit_size $commit_hash"; done | sort -nr --field-separator=' ' --key=8 | head -20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment