Modern native Git hooks made easy
Husky improves your commits and more 🐶 woof!
npm install husky -D
Edit package.json > prepare
script and run it once:
npm pkg set scripts.prepare="husky install"
npm run prepare
Add a hook:
npx husky add .husky/pre-commit "npm test"
git add .husky/pre-commit
Make a commit:
git commit -m "Keep calm and commit"
# `npm test` will run every time you commit
For more use cases (project in sub-directory, custom directory, CI support, ...), see documentation.
https://typicode.github.io/husky
Important Upgrading from v4 to v8 requires migrating previous config, please see the docs.
MIT
Does your company use husky? Ask your manager or marketing team if your company would be interested in supporting this project.
Find husky helpful? Become a backer and show your appreciation with a monthly donation on Open Collective. You can also tip with a one-time donation.
GitHub sponsors can be viewed on my profile. All past and current Open Collective sponsors can be viewed on here.