What we want to do in the first example is to check whether or not the defect information is correct. There is no need to release a commit that refers to a defect that does not exist:
- We will start by testing the commit-msg hook. First, make a copy of the current hook, then we will force the hook to exit with a non-zero value that will abort the creation of the commit:
$ cp .git/hooks/commit-msg.sample .git/hooks/commit-msg
- Now, open the file in your preferred editor and add the following lines to the file:
#!/bin/bash echo "you are not allowed to commit" exit 1
- Now, we will try to make a commit and see what happens, as follows:
$ echo "Frogs, scallops, and coco shell" >> fishtank.txt $ git add fishtank.txt $ git commit ...