A githook that validates commit messages follow a (modified) conventional commit spec
- python3
- git
- curl
Run the installation script from your repo's root
curl -fsSL https://raw.githubusercontent.com/fluxdiv/cc_validator/main/installer.py | python3
This does the following:
- Verifies the repo is a git repo
- Checks whether git hooks have already been set up
- If they have, the hook will be setup the same way
- If not, a
~/my_repo_root/.githooks/dir is created, and is added to the repo's git config viagit config core.hooksPath .githooks - The commit-msg hook is created/copied and set as executable
- Setup complete, commits will not be allowed unless they follow the spec
Setup the hook manually:
- Create a
.githooksdirectory in the root of your repo - Create a
.githooks/commit-msgfile - Copy the contents of the commit-msg hook into the file
- Set as executable
chmod a+x .githooks/commit-msg - Set the repo's git config to use it
git config core.hooksPath .githooks - Setup complete