Update 160912: There is a new post here.

I'm currently working with a customer that has around 30 comitters working on the same code base. We are using Git with Atlassian Stash.

Reccently some code were released to production earlier then planned. Because of a faulty merge about 10 weeks earlier. This brings up the subject of commit comments. I started looking around for a good commit checker for Stash. I found mainly one problem with the existing hooks. It was not possible to customize messages shown to comitters when rejected.

So I created Simple Stash Commit Checker. The code is available here. It is highly configurable. For any rejection reason, there is a configurable response.

Config Email

Email and author can be checked against corresponding value in Stash.

Config Email

If you enable this kind of plugin, the developers may need some time to adjust. Thats why I added a dry run mode. Where rejection messages are shown but no commits are actually rejected.
Dry run

It is possible to add groups of restrictions. A group could be Issues. And rules in the groups. A rule could be, for example, Jira and/or Incident. And the group could state that at least one issue should be mentioned in the commit.

Groups

The group could also accept commits that does not contain some specific word. Some people like to write fixing review comments or fixing sonar errors. There could be a rule rejecting commits containing sonar or review. With a rejection reason like: It is not relevant to mention that the changes were suggested by Sonar or from a review. It is relevant to mention what is actually changed and how that improves the code.