-
-
Notifications
You must be signed in to change notification settings - Fork 111
How to setup conventional commits git commit msg hook
We use Conventional Commits for commit messages, for example:
fix(windows): Re-attaches the widget plug which had fallen out
. Full details.
You can setup a commit-msg hook in your local git environment to ensure that your commit messages meet our standard. This can be setup on a single repository (e.g. keymanapp/keyman
) or globally, which will check commits on all keymanapp repositories on your system.
Once configured, updates to the hook configuration will automatically be applied through git pulls.
Warning: the global hook configuration will override any other global git hooks that you have configured because it will update your core.hooksPath
git global setting. If you have existing global hooks, then you should manually configure your commit-msg hook to call the keymanapp/keyman/resources/git-hooks/commit-msg
hook in your existing global hooks folder.
To setup the hook, start a shell (Git Bash on Windows), navigate to the root of your local keymanapp/keyman repo clone and run:
./configure-repo.sh --global
This will work only for the keyman repo, not other related repos. On Windows, start an elevated Git Bash shell (mklink
requires Administrator level access). On other operating systems, start a shell. Navigate to the root of your local keymanapp/keyman repo clone and run:
./configure-repo.sh --local
That's it.
It's automatic. If you run in a terminal, you should get coloured error messages if you format your commit message wrongly. Read the workflow notes for full details on how to format a commit message. Here's a simple example:
fix(windows): Re-attaches the widget plug which had fallen out. Fixes #1234