I have created a precommit clientside githook in my .git/hooks directory. This is a hidden directory but I want to save this to my repo. How can I save this in the repo and deploy this for other developers? I am using windows 7 and the precommit is a node mochajs unittest.
You can save the precommit hook directly in your repo and version it.
But you cannot force its activation, which would have to be done by the developer cloning the repo and making a symbolic link, mklink
on Windows, between that repo file and his/her own .git/hook
.
The other approach, if you have access to the remote server, is to setup a pre-receive
hook which would to the mochajs unit-test for you, and reject the push if the test fails.