Git hook scripts are useful for identifying simple issues before submission to code review. We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing whitespace, and debug statements. Checkout pre-commit
hook site for more details.
You can setup pre-commit
hook by running:
brew install pre-commit
or if you prefer pip
pip install pre-commit
You can have a look at some basic pre-commit hooks that I have added under pre-commit-config.yml file. You can checkout all the pre-commit hooks
here. And add any hook that you like in this file.
Now, install the pre-commit hook by running:
pre-commit install
you will see
pre-commit installed at .git/hooks/pre-commit
This means pre-commit hook were installed successfully.