Last Updated: September 01, 2020
·
15
· rajivrnair

Git hook to enforce commit message in the format "#<issue number> | <message>"

git

$ vi .git/hooks/commit-msg

#!/bin/sh
test "" != "$(grep -Ei '^#[0-9]+\s?\|' "$1")" || {
    echo >&2 Yo! Commit message needs to be in the form '#<issue number> | <text message>'.
    exit 1
}