Problem: Git pre-commit hooks are slow, which is annoying when I commit...
Problem: Git pre-commit hooks are slow, which is annoying when I commit frequently.
Solution: Skip them like this:
git commit -m “message here” -n
The -n disables the pre-commit hook. 😎
“But you’re skipping a check! That’s risky!”. No, it's not.
The pre-commit hook merely provides early feedback. The CI server protects the code.
Pre-commit hooks are like client-side validation. They provide early feedback, but no actual safety.
CI provides true safety.
To clarify, pre-commit hooks can be useful, because they tend to catch some issues faster than CI. But until I'm done, I don't care if the build passes. So, I skip the pre-commit checks until I think I'm nearly done.