In this lesson we will look about how we can integrate with git hooks to help enforce a certain level of quality before you either commit your code or push to a remote repository.
Install:
npm i -D husky
Add script:
For each commit:
"precommit": "npm t"
This will run before each commit.
For each push:
"prepush": "npm t"
This will run before each push.
But if for some reason, if you want bypass the precommit or prepush check, you can do:
git commit -m "commit message" --no-verify
[NPM] Run npm scripts with git hooks
原文:http://www.cnblogs.com/Answer1215/p/6375969.html