Open axe312ger opened 7 years ago
The validateMessage
function is called from GIT on the commit-msg
hook.
Implementing this can be done manually or automatically.
Manually: After installing this package (npm install angular-precommit
or npm install
if saved in your package.json
) run the ln -s node_modules/angular-precommit/index.js .git/hooks/commit-msg
command.
Automatically: Add the package to your package.json
(npm i --save-dev angular-precommit
) then modify your package.json
scripts section to have a postinstall
hook.
"scripts": {
"postinstall": "ln -s node_modules/angular-precommit/index.js .git/hooks/commit-msg"
},
NOTE: If using CYGWIN or MINGW, you may have to cd
into the git hooks directory and run the postinstall command from there.
cd .git/hooks && ln -s ../../node_modules/angular-precommit/index.js commit-msg
thank you very much! 👍
Did it work for you after that @axe312ger? It doesn't work for me on the command line even though I can see the aliased file in my git hooks directory. I used this tool back in the day but it no longer prevents commit messages that don't follow the Angular format.
EDIT: I was able to get it to work by copying the file into the git hooks directory as commit-msg
instead of linking it. Still doesn't work in GitX, as the comment in the source code mentions, but it does work on the command line.
@marcysutton I think it worked, but I no more have access to the code base I applied it to it.
Nowadays, I just make sure nothing gets merged into master not following the conventions. Rewriting the commit messages before merging into master is the key. Or asking the contributor to do it :)
When follow the instructions, i end up with no git hook called at all.
Also your code looks like, it does nothing, you just define some vars and functions and do nothing with them.
Can you please clearify how this works?