JIRA 智能提交 - 阻止 git 没有 JIRA 票号的提交
JIRA smart commit - Block git commit without JIRA ticket number
如果提交消息不包含 JIRA 票号,我将尝试阻止 GIT 提交。有人能做到吗?
根据我的理解,以下提交消息将在票证 WEBSITE-4
上记录提交消息。
JIRA:WEBSITE-4 #comment Testing smart commit.
但是我需要一种方法来阻止提交,只要用户忘记在提交消息中包含 JIRA:<ticket number>
。
如果你有自己的 Bitbucket 服务器,你可以添加一个像“Yet Another Commit Checker”这样的插件,它正是这样做的:
Yet Another Commit Checker is a Stash plugin that allows you to reject commits to a repository based on configurable rules. Its main feature is requiring commit messages to contain a valid JIRA issue,
查看其GitHub repo。
如果不是,如discussed here, you need a pre-commit hook (client side) or a pre-receive hook (but for a public BitBucket server, that would mean a webhook) See "Hooked on Stash"。
"Require issue keys in commit messages"提到 has been introduced for BiBucket Cloud in May 2017
This thread 添加:
As long as you setup your links under repository settings to hook with JIRA, you do NOT HAVE TO switch on "Require issue keys in commit messages" under Bitbucket Repository -> Settings -> Links
.
That is basically a rule you are setting that no one can push anything without issue keys. If you want to disable temporarily, then you can switch it off and on any time.
Bitbucket Server does not have the same option to require issue keys in commit comments out-of-the-box.
You would have to get an app (like Jira hooks for Bitbucket or Better commit policy for Bitbucket) or write your own in order to get that functionality.
Or:
在 Bitbucket 云上
- 转到您的 Bitbucket 存储库 -> 设置 -> 链接
- 开启 "Require issue keys in commit messages"
如果提交消息不包含 JIRA 票号,我将尝试阻止 GIT 提交。有人能做到吗?
根据我的理解,以下提交消息将在票证 WEBSITE-4
上记录提交消息。
JIRA:WEBSITE-4 #comment Testing smart commit.
但是我需要一种方法来阻止提交,只要用户忘记在提交消息中包含 JIRA:<ticket number>
。
如果你有自己的 Bitbucket 服务器,你可以添加一个像“Yet Another Commit Checker”这样的插件,它正是这样做的:
Yet Another Commit Checker is a Stash plugin that allows you to reject commits to a repository based on configurable rules. Its main feature is requiring commit messages to contain a valid JIRA issue,
查看其GitHub repo。
如果不是,如discussed here, you need a pre-commit hook (client side) or a pre-receive hook (but for a public BitBucket server, that would mean a webhook) See "Hooked on Stash"。
"Require issue keys in commit messages"提到
This thread 添加:
As long as you setup your links under repository settings to hook with JIRA, you do NOT HAVE TO switch on "Require issue keys in commit messages" under
Bitbucket Repository -> Settings -> Links
.
That is basically a rule you are setting that no one can push anything without issue keys. If you want to disable temporarily, then you can switch it off and on any time.
Bitbucket Server does not have the same option to require issue keys in commit comments out-of-the-box.
You would have to get an app (like Jira hooks for Bitbucket or Better commit policy for Bitbucket) or write your own in order to get that functionality.
Or:
在 Bitbucket 云上
- 转到您的 Bitbucket 存储库 -> 设置 -> 链接
- 开启 "Require issue keys in commit messages"