Hooks are plugins which can be launch by git, on a special event.
The commit-msg
hook, if defined, is launched when user want commit
It's a git-enforced policy, used in entreprise to force dev to correctly format their commit messages
Here is a custom commit-msg
hook which looks for a format like these both:
- [ADD] - It's a message where i add something
- [JIRA] #456 - I correct this jira
@see this snippet
cd the-path-of-your-project
cd .git/hooks
touch commit-msg
nano commit-msg
- Do your stuff or copy/past this snippet.
exit edit mode
chmod +x commit-msg
- Have fun =]