The exact need is to force all commits into Bitbucket to be linked to a JIRA ticket.
I have does this before on Subversion by creating a commit hook that looked for the JIRA ticket in the commit text, but I don't want this solution to be necessarily constrained to that prior experience.
Does Bitbucket have a setting somewhere to force association for all commits against Jira tickets? If not - does it have a mechanism for enforce commit comment quality (some sort of hook or regex)? If not - does GIT have something that we can use for this purpose?
The imagined solution is (but not limited to being) a commit hook that fails the commit if the comment text does not contain a leading JIRA ticket, followed by a colon, followed by some commit text, such that:
git commit -m "foo"
fails and
git commit -m "PRJ-9327: foo"
commits...
Go to the code page and select “Connect to Bitbucket”, then choose the Bitbucket workspace you want to connect. Once you've connected Jira with Bitbucket Cloud, you can connect repositories to your project by including issue keys at the beginning of your branch names, commit messages, or pull requests.
Open a Jira issue then go to the Git Commits tab. In this tab, you will see commits, files changed, links to external repository, commit author and more. git commit message to link the commit to this issue. The git commit will get associated with the Jira issue if the commit message includes the exact issue ID.
Log in to Jira Software as a user with administrative permissions. Go to Administration > Applications > DVCS accounts. Click the (settings) icon for the account. Click Enable Smart Commits on new repositories.
In Sourcetree, you can select the commit for which the message needs to be modified and then choose "Interactive Rebase.." from the Repository menu. Use "Edit Message" during the rebase to include the JIRA key and click "Ok" to save the change.
The BitBucket issue 5658 just got implemented today (April 13th, 2017)
Option to reject commits without an issue key in their message
This feature is now available to all users via the repository settings "
links
" pageThe pre-receive hook that rejects pushes when any commit does not have a valid issue key in its message.
The current implementation relies on the per-repository "Links
" setting to determine what a valid issue key looks like. This gives us the ability to validate against Jira, Bitbucket Issues, Connect add-ons, and any configured custom Links.
So you don't need for a third-party plugin anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With