Pre-commit Git Hook¶
Main point
The Pre-commit Git Hook is run - surprise, surprise - before you commit! 😀 It is a perfect opportunity to run tests and linters.
Regardless of your discipline as a software programmer or simply how good is your memory, Pre-commit Git Hook will check your code automatically. In effect:
- Your code stays consistent and readable.
- All while keeping to pass both new and regression tests.
Pre-commit Git Hook is a match made in heaven when combined with properly configured Continuous Integration. It can save you a lot of time (and nerves!) when you have a solid opportunity to fail the checks locally i.e. before being officially rejected by your hosted VSC provider.
You can find an example of Pre-commit Git Hook in Big-Bang-py.
set_precommit
Invoke task in Big-Bang-py takes your Pre-commit Git Hook from/githooks/pre-commit
and automatically sets it up for you.