Skip to content

Instantly share code, notes, and snippets.

@norrs
Created June 19, 2012 16:55
Show Gist options
  • Save norrs/2955246 to your computer and use it in GitHub Desktop.
Save norrs/2955246 to your computer and use it in GitHub Desktop.
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment