-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alban King
committed
Aug 9, 2023
1 parent
68d1bda
commit 9bb5fc6
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
# commit message check | ||
A pre-commit (project) hook to verify commit messages conform to a pattern. | ||
Specifically it checks that the first `n` commits on a branch fit the pattern (checking evey commit is trivial with pygrep) | ||
This uses the `commit-msg` stage hook, be sure you have installed that hook. | ||
|
||
## the length of which branch? | ||
This tool assumes you are following the common convention of creating small feature branches from a default branch. | ||
The default branch is found by inspecting `origin/HEAD`, you can overwrite this with the arg `-b=<some-weird-branch>`. | ||
|
||
## usage | ||
Here's an example `.pre-commit-config.yaml` which enforces the first 3 commits on a branch have a message starting like `ABCD-001`, `TICK-33310` | ||
|
||
`.pre-commit-config.yaml` | ||
~~~ yaml | ||
default_install_hook_types: [pre-commit, commit-msg] | ||
repos: | ||
- repo: https://github.com/kingalban/commit-msg-check.git | ||
rev: v0.1.0 | ||
hooks: | ||
- id: check-commit-message-pattern | ||
args: [-n=3, "-p=^[A-Z]{4}-[0-9]+"] | ||
|
||
~~~ |