Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Alban King committed Aug 9, 2023
1 parent 68d1bda commit 9bb5fc6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
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]+"]

~~~

0 comments on commit 9bb5fc6

Please sign in to comment.