automatically append JIRA issue ID into commit message

I wonder whether it is possibel to automatically append the JIRA issue ID to every commit message automatically?

All our branch names include the issue id with the issue type name.

Is there a way to automatically append it to a commit message when commiting?

We are using script runner, maybe there is a way to do it with it?


2 answers

0 votes

By the time the commit is created with the original commit message, it gets its hash. If you changed the commit message afterward (even programatically), that'd result in a new hash which could eventually break things.

So, I'd suggest you'd rather require committers to enter the issue key in the commit message (a'priori).

But this kind of thing get forgotten, it has to be done automatically.

Maybe via a commit pre hook? Any idea how to do this?

What version control system are you using?

Bitbucket with git

Now that I know the environment, I added a new answer.

0 votes

Commit Policy is an add-on for Bitbucket that enforces this via a custom hook.

See the full documentation here.

does it enforce that the user to insert the issue ID in the commit message?

Or does it automatically append the issue ID into the commit?

The later is prefered.

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

678 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot