The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

post-commi hook to check format of message

Neil Hunt
March 19, 2013

Hello, I am trying to setup a post-commit hook to check the format of the commit message (basically to enforce that it references a corresponding Jira issue number). I see some threads about POST messages, but I'm unclear how to set this up and how it can deny the commit if that's what we want it to do?

Should I be thinking of this in terms of each user's git repository? Do we embed the post-commit hook into the .git directory and then rely on this working PRIOR to any pushes?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
m
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 8, 2013

Hi,

You need to implement a client-side hook for this. Why? You want to check the commit message before it reaches Bitbucket. The BB POST service executes as a post-receive hook.

Post-commit hooks are client-side hooks that happen after a commit is processed. It is usually used for notifications. You most likely want a commit-msg hook.

Great doc on Git commit hooks:

http://git-scm.com/book/en/Customizing-Git-Git-Hooks

Google "git commit-msg hook" to find helpful examples.

Mary

TAGS
AUG Leaders

Atlassian Community Events