Skip to content

Instantly share code, notes, and snippets.

rockj@pandora:/tmp/foo$ .git/hooks/commit-msg.sample /tmp/commitmsg.txt
rockj@pandora:/tmp/foo$ .git/hooks/commit-msg.sample /tmp/bad-commitmsg.txt
Requires valid ticket number
rockj@pandora:/tmp/foo$ cat .git/hooks/commit-msg.sample
#!/bin/sh
test "" = "$(head -1 "$1" | grep -vE ^[[:alpha:]]\{2,3}-[[:digit:]]\{1,3})" || {
echo >&2 Requires valid ticket number
exit 1
}