I want to restrict the people whoever commits to have a specific commit message format, how do I do that?
For example: Pair_Name|Story_Number|Commit_Message
I want to restrict the people whoever commits to have a specific commit message format, how do I do that?
For example: Pair_Name|Story_Number|Commit_Message
Note: this kind of restriction is part of gitolite as well (an authorization layer that allows all sort of checks when pushing to a repo)
You can see one example at "git gitolite (v3)
pre-receive
hook for all commit messages".The idea with gitolite is that you can easily deploy that hook on specific repos, for specific groups of users.
There is a
pre-commit-msg
orcommit-msg
hook, that you could use:Git repos come with sample hooks, e.g. the sample
commit-msg
hook undergit/hooks/commit-msg.sample
catches duplicate Signed-off-by lines.To enable a hook, don't forget to make it executable.
Here's some fictional example, which would only accept commit messages of the
london|120|something ...
and the like:In usage: