Git hooks are scripts that run automatically every time a particular event occurs in a Git repository. They let you customize Git's internal behavior and trigger customizable actions at key points in the development life cycle.
In this case we are changing the prepare-commit-msg hook, to add the boilerplate in the beginning of the commit message automatically.
- My commit message
- StudyMesh:DEV My commit message
To allow this behaviour to happen, it is needed to execute the following command:
tools/git-hooks/init.shTo check if it worked, run this command:
ls -lisa .git/hooks/This file should appear -> prepare-commit-msg.
To test that the git hook is working as intended. Execute the following command:
tools/git-hooks/lib/bashunit tools/git-hooks/testsThis command is using bashunit (a bash testing framework) over the tests folder to check if the tests are passing.