Copy this file under the name pre-commit into your repository's .git/hooksdirectory. You may need to use chmod +x to enable execution.
Script exscution can be skipped with git commit --no-verify which can skip lengthy test execution on simple changes to documentation.