git config --global init.templatedir '~/.git-templates'
- so git will copy all templates into new or cloned repositorymkdir -p ~/.git-templates/hooks
touch ~/.git-templates/hooks/pre-commit
chmod +x ~/.git-templates/hooks/pre-commit
- Update
~/.git-templates/hooks/pre-commit
with the following content
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
MASTER_CHECK_ENABLED="$(git config --get custom.hooks.mastercheck || echo 'true')"