Commit Check is a free, powerful tool that enforces commit metadata standards, including commit message, branch naming, committer name/email, commit signoff and more.
Fully customizable with error messages and suggested commands, it ensures compliance across teams.
As an alternative to GitHub Enterprise Metadata restrictions and Bitbucket's paid plugin Yet Another Commit Checker, Commit Check stands out by integrating DevOps principles and Infrastructure as Code (IaC).
- Commit Check uses a default configuration if you do not provide a
.commit-check.ymlfile. - The default configuration enforces commit message rules based on the Conventional Commits specification and branch naming rules based on the Conventional Branch convention.
To customize the behavior, create a config file .commit-check.yml under your repository's root directory, e.g., .commit-check.yml
Please see commit-check/commit-check-action
Tip
Make sure pre-commit is installed.
- repo: https://github.com/commit-check/commit-check
rev: the tag or revision
hooks: # support hooks
- id: check-message # requires prepare-commit-msg hook
- id: check-branch
- id: check-author-name
- id: check-author-email
- id: check-commit-signoff
- id: check-merge-base # requires download all git history
- id: check-imperativeInstall globally
sudo pip3 install -U commit-checkInstall locally
pip install -U commit-checkInstall from source code
pip install git+https://github.com/commit-check/commit-check.git@mainThen, run commit-check --help from the command line. For more information, see the docs.
To configure the hook, create a script file in the .git/hooks/ directory.
#!/bin/sh
commit-check --message --branch --author-name --author-email --commit-signoff --merge-base --imperativeSave the script file as pre-push and make it executable:
chmod +x .git/hooks/pre-pushNow, git push will trigger this hook automatically.
Check Commit Message Failed
Commit rejected by Commit-Check.
(c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c)
/ ._. \ / ._. \ / ._. \ / ._. \ / ._. \
__\( C )/__ __\( H )/__ __\( E )/__ __\( C )/__ __\( K )/__
(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)
|| E || || R || || R || || O || || R ||
_.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._
(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)
`-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´
Type message check failed => my test commit message
It doesn't match regex: ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)
The commit message should be structured as follows:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
More details please refer to https://www.conventionalcommits.org
Suggest: please check your commit message whether matches above regex
Check Branch Naming Failed
Commit rejected by Commit-Check.
(c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c)
/ ._. \ / ._. \ / ._. \ / ._. \ / ._. \
__\( C )/__ __\( H )/__ __\( E )/__ __\( C )/__ __\( K )/__
(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)
|| E || || R || || R || || O || || R ||
_.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._
(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)
`-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´
Commit rejected.
Type branch check failed => patch-1
It doesn't match regex: ^(bugfix|feature|release|hotfix|task|chore)\/.+|(master)|(main)|(HEAD)|(PR-.+)
Branches must begin with these types: bugfix/ feature/ release/ hotfix/ task/ chore/
Suggest: run command `git checkout -b type/branch_name`
Check Commit Signature Failed
Commit rejected by Commit-Check.
(c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c)
/ ._. \ / ._. \ / ._. \ / ._. \ / ._. \
__\( C )/__ __\( H )/__ __\( E )/__ __\( C )/__ __\( K )/__
(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)
|| E || || R || || R || || O || || R ||
_.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._
(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)
`-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´
Commit rejected.
Type commit_signoff check failed => c92ce259ff041c91859c7fb61afdbb391e769d0f
It doesn't match regex: Signed-off-by:.*[A-Za-z0-9]\s+<.+@.+>
Signed-off-by not found in latest commit
Suggest: run command `git commit -m "conventional commit message" --signoff`
Check Imperative Mood Failed
Commit rejected by Commit-Check.
(c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c)
/ ._. \ / ._. \ / ._. \ / ._. \ / ._. \
__\( C )/__ __\( H )/__ __\( E )/__ __\( C )/__ __\( K )/__
(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)
|| E || || R || || R || || O || || R ||
_.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._
(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)
`-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´
Commit rejected.
Type imperative check failed => Added file
It doesn't match regex: imperative mood pattern
Commit message should use imperative mood (e.g., "Add feature" not "Added feature")
Suggest: Use imperative mood in commit message like "Add", "Fix", "Update", "Remove"
You can add a badge to your repository to show that you use commit-check!
Markdown
[](https://github.com/commit-check/commit-check)
reStructuredText
.. image:: https://img.shields.io/badge/commit--check-enabled-brightgreen?logo=Git&logoColor=white
:target: https://github.com/commit-check/commit-check
:alt: commit-check
Versioning follows Semantic Versioning.
Please post to issues for feedback, feature requests, or bug reports.
This project is released under the MIT License