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?
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
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.