There is a commit policy plugin for Bitbucket server and data center but I can't find anything for cloud. I need to implement a specific format. In order to link our JIRA issues to the commits we're focusing on smart commits. But in order to enforce the smart commit policy I need to set up a gate so I only commit with proper format followed go through.
Hi @Ci Admin ,
I'm afraid that this is not possible in Bitbucket Cloud. We have an option to enforce JIRA issues keys in commit message (it can be found in Repository settings > Links), but we don't support server side hooks at the moment that would allow rejecting commits based on the commit message format.
We have a feature request for a server-side pre-receive hook that you can vote for, add yourself as a watcher and also leave any feedback:
In the meantime, the suggestion I can make as a workaround would be to use client side hooks, you can check an example here:
These will need to be configured by every user in the local clone of the repo they are working on, in the .git/hooks directory of the local repo. From the link I included above:
Because hooks aren’t transferred with a clone of a project, you must distribute these scripts some other way and then have your users copy them to their .git/hooks directory and make them executable.
Please feel free to let me know if you have any questions.
Kind regards,
Theodora
The mentioned "commit policy plugin for data center" is now available on Cloud!
Implementing commit policies, commit message standards, and pull request rules in Bitbucket Cloud is possible.
Better Commit Policy for Jira Cloud, along with the Better Commit Policy Connector for Bitbucket Cloud, brings commit message rules and pull request standards to Bitbucket Cloud workspaces.
You can now:
Enforce commit message formats (including Smart Commit syntax)
Require that commits include valid Jira work keys
Validate issue keys against project, status, or even assignee
Block pull requests with non-compliant commits before they merge
It works via a merge check in Bitbucket Cloud, and policies are defined as code using YAML files—version-controlled and audit-friendly.
This should give you exactly the kind of "gate" you're looking for to enforce Smart Commit formatting before code is merged.
(I'm part of the Midori team developing the Better Commit Policy apps.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We have added commit policy support to Flowie, a Bitbucket Cloud addon. It creates checks against the commit message.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ci Admin
Do you use Jira in Cloud as well (at all?) In the off chance that you also use Jira Server or Data Center, you can implement (have your developers install) a local commit verification hook script that would enforce your rules. Read more on this here.
I know it's a cumbersome workaround and only works if you have Jira Server/DC, but it's the best we could come up with until BCLOUD-10471 is not implemented.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.