Get Started
Install
npm install --save-dev husky
Husky Init
The init command simplifies setting up husky in a project. It creates a pre-commit script in .husky/ and updates the prepare script in package.json. Modifications can be made later to suit your workflow.
npx husky install
Pre-commit hook
touch .husky/pre-commit
echo "npm run test" > .husky/pre-commit
Try It
git commit -m "Keep calm and commit"