Git · Hooks
commit-msg hook
Validates the commit message, for example against Conventional Commits.
Syntax
.git/hooks/commit-msgExample
Example
#!/bin/sh
grep -qE '^(feat|fix|docs|chore):' "$1" || { echo "Bad message"; exit 1; }More in this group
Learn this in the course
Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.