I'm probably dumb for not knowing this until Claude taught me today, but can run a pre-commit git hook. Usefu…
I'm probably dumb for not knowing this until Claude taught me today, but can run a pre-commit git hook. Useful for catching large files that you might have not caught in your .gitignore, and avoiding a situation where you can't push a commit due to large file size. No dependencies, this is a git feature, you could save the below in \.git/hooks/pre-commit\, which would make sure to exclude any files above 50MB when you make your commits: \\\ \# Check for files larger than 50MB largefiles=$(git diff --cached --name-only --diff-filter=A | xargs -I {} find {} -size +50M 2>/dev/null) if \[ -n "$largefiles" ]; then echo "Error: The following files are larger than 50MB and cannot be committed:" echo "$large_files" echo "Please remove these files or add them to .gitignore" exit 1 fi \\\