正如这个答案所提到的,可以在Github提交中引用一个问题。
如果格式不正确,是否可能拒绝提交?
例如:
fix gh-12 foo bar
是正确的
foo bar
将是错误的
更新:
接近成功了,但仍有问题... 有什么想法吗?
我现在在这里:.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