Global configuration
Commitlint
Section titled “Commitlint”Commitlint can install a global configuration for you. You can do so by running the following command:
commitlint install --globalThis will place a commitlint.yml in one of the following locations:
~/.config/commitlint/commitlint.ymlc:/Users/<username>/AppData/Roaming/commitlint/commitlint.ymlAlongside the configuration file a hooks folder is created with a default commit-msg hook.
To use the hook you need to add a global hooks directory to your git config.
To automatically register the commitlint hooks directory to your git config you can use the --register-hooks flag alongside the --global flag:
commitlint install --global --register-hooksOr manually using the following command:
git config --global core.hooksPath ~/.config/commitlint/hooksgit config --global core.hooksPath c:/Users/<username>/AppData/Roaming/commitlint/hooksOr add the path to your gitconfig:
[core] hooksPath = ~/.config/commitlint/hooks[core] hooksPath = c:/Users/<username>/AppData/Roaming/commitlint/hooksCustom hooks path
Section titled “Custom hooks path”You can also use a custom path for your hooks. Ensure you have a commit-msg hook with the following content:
#!/bin/shcat $1 | commitlintThis will ensure that commitlint is run on every commit message.
After that you can run the following command to add the hooks directory to your git config:
git config --global core.hooksPath <your git hooks path>Or add the path to your gitconfig:
[core] hooksPath = <your git hooks path>