As mentioned in this answer, it is possible to reference an issue in a Github commit.
Is it possible to reject a commit of it is not formatted like this?
Example:
fix gh-12 foo bar
is correct
foo bar
would be wrong
Update:
Almost there, this still isn't working... Any thoughts?
I now have the following in: .git/hooks/commit-msg
#!/bin/bash
commit_regex='(gh-[0-9]+|merge)'
error_msg="Aborting commit. Your commit message is missing either a Github Issue ('gh-1111') or 'Merge'."
if ! grep -E "$commit_regex" <<< "$0"; then
echo "$error_msg" >&2
exit 1
fi