I create a commit-msg hook in myrepo/.git/hooks
.
#!/bin/sh
message=`cat $1`
c=`echo $message|grep -c 'fff'`
if[ $c -gt 0 ];then
echo "Error"
exit 1
fi
exit 0
When I try to commit like so, an error occurs and it blocks the commit.
$ git commit -m "reffrffffeffff fffeef"
Error
I then do the following:
$ cd myrepo
$ mkdir .hooks
$ mv .git/hooks/commit-msg .hooks/commit-msg
$ ln -s .hooks/commit-msg .git/hooks/commit-msg
and try to commit again with the same message. The commit succeeds. I guess I may have done something wrong in the above steps?
Can anyone tell me how to make a client-side hook, and have each developer get restrictions from this hook?