- Ruby
- Git
- Standard
Create a git pre commit hook and give it permission to execute:
touch .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
Add the following bash script to the hook:
#!/bin/sh
standardrb --fix --format progress $(git diff --name-only --diff-filter=ACMRTUXB master | grep -E "(.rb$)")
Very helpful, thanks! but heads up -- I had to update to
| grep -E "(\.rb$)"
to get just "*.rb" without*.erb
.