Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Commit Message check in Push Check


I am try to control commit messages by enforcing developers to use particular JIRA ID in their commit message, but when I go to Hooks in settings and then push check plugin. The push is getting rejected as  the  commit message is not matching the given regular expression.

I want to commit message to have G1990 in it.

Can someone help me in this?




2 answers

1 accepted

0 votes
Answer accepted

Hi Sumit,

I guess you have to use .*G1990.* .

It is not contains check, it is must match check. So when we give (G1990) as regex, the commit which have only G1990 as message will be accepted and other commits will be rejected even when we added single character.


On the other hand, .*G1990.* , allow all the commits which contains G1990, because .(dot) means any character and *(asterisk) means anytime. Basically we are telling that commit message can have any char at n number of times before and after G1990.


Please let me know, if my answer helps you.

Thank you for your response Allen. I tried it below is the screenshot attached showing the errorBB_Error.PNG.

@Sumit , use .*G1990.* instead of *.G1990.*.


For more clear,

dot*G1990dot* (replace dot with .)

my bad. i tried to push it with commit messages, it gave me below error.

git commit -m "G1990"

git commit -m "G1990 Testing"


remote: [Syntax check]
remote: rejected. pls include Jira #

! [remote rejected] (pre-receive hook declined)

I guess, you have few more previous commits which is not matching.


Please run hg out or git log --branches --not --remotes=origin this command and make sure you have only one commit with "G1990 Testing" as message.

It worked, as a charm. Thank you so much Allen for your help.

Like Barry Allen likes this

Hello there,


you can also require commits to be associated with Jira issues using a simple shell script and external hooks add-on, check it there — example 

Thanks for the info.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,925 views 10 16
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you