NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1435 most downloaded on npm
Modern native Git hooks
Last release 2 years ago
no release in 18 months
Release timing varies
gaps range from 9 days to 13 months
Most releases are documented
notes for 49 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
215 releases · first in 2014
fix: add husky label to deprecated warning by @smackfu in #1538
Fix issue where example pre-commit file is generated incorrectly by @dexmlee in #1519
Full Changelog: v9.1.5...v9.1.6
One column per quarter.
fixes #1494 , support pre-merge-commit hook by @RainMeoCat in #1497
pre-merge-commit hook by @RainMeoCat in #1497Full Changelog: v9.1.4...v9.1.5
Improve deprecation notice
fix: better handle space in PATH
PATHShow a message instead of automatically removing deprecated code.
Show a message instead of automatically removing deprecated code.
This only concerns projects that still have the following code in their hooks:
- #!/usr/bin/env sh # <- This is deprecated, remove it
- . "$(dirname -- "$0")/_/husky.sh" # <- This is deprecated, remove it
# Rest of your hook codeHooks with these lines will fail in v10.0.0
Super saiyan god dog! It's over 9.0.0!
Super saiyan god dog! It's over 9.0.0!
You can now run package commands directly, no need for npx or equivalents.
It makes writing hooks more intuitive and is also slightly faster 🐺⚡️
# .husky/pre-commit
- npx jest
+ jest # ~0.2s fasterA new recipe has been added to the docs. Lint staged files without external dependencies (inspired by Prettier docs). Feel free to modify it.
# .husky/pre-commit
prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown
git update-index --againFor more advanced use cases, see lint-staged.
bunx husky init command#!/usr/bin/env sh and . "$(dirname -- "$0")/_/husky.sh" are deprecated. husky command will automatically remove them, no action required.~/.huskyrc please move it to .config/husky/init.shSupport for these will be removed in v10.
If Git hooks don't fit your workflow, you can disable Husky globally. Just add export HUSKY=0 to .config/husky/init.sh.
I've seen some confusion about this on X, so just a heads-up!
Husky is downloaded over 45M times per month and used by ~1.5M projects. If your company wants to sponsor, you can do so here: GitHub Sponsors.
Have a nice summer ☀️ I'm open to new opportunities/consulting so feel free to drop me a message 😉
Nothing published for this version
fix: rename index.d.ts to index.d.mts by @mrkjdy in #1379
refactor: rename files by @typicode in https://github.com/typicode/husky/pull/1378
docs: update index.md by @khaledYS in https://github.com/typicode/husky/pull/1369
fix: typo and source ~/.huskyrc correctly (compatibility with v8)
~/.huskyrc correctly (compatibility with v8)docs: add favicon by @rakleed in https://github.com/typicode/husky/pull/1354
docs: update path to startup files by @ManuelRauber in https://github.com/typicode/husky/pull/1350
fix: init create dir before by @typicode in https://github.com/typicode/husky/pull/1348
docs: fix link by @typicode in https://github.com/typicode/husky/pull/1340
fix: exit code by @gergelypap in https://github.com/typicode/husky/pull/1336
Removed husky install. Use husky or husky some/dir for the same functionality (deprecation notice to be added).
<p align="center"> Kicking off the year with an exciting update! </p>
<p align="center"> <img src="https://github.com/typicode/husky/assets/5502029/457ab087-e935-4196-b99f-601ecf37f263" height="400px" alt="" /> </p>
Note: install using husky@latest to get the bug fixes that were released after.
husky initnpm pkg set scripts.prepare="husky install"
npm run prepare
npx husky add .husky/pre-commit "npm test"
Adding husky to a project is now easier than ever. It's just a single line that does the same as above. No need to read the docs to get started anymore.
npx husky init
npx husky add .husky/pre-commit "npm test"
git add --chmod=+x .husky/pre-commit # On Windows
Adding a hook is as simple as creating a file. This can be accomplished using your favorite editor, a script or a basic echo command. For example, on Linux/macOS:
echo "npm test" > .husky/pre-commit
v8 was already the most compact Git hooks manager at approximately 6kB.
v9 takes this a step further, reducing the size to just 3kB, likely making it the smallest devDependency in your toolkit.
To give you an idea of how small it is, the biggest file in the project is the MIT license 😄
Additional features are in the pipeline for v9. Stay tuned :raised_hands:
--provenance for safer publishing.$XDG_CONFIG_HOME support. Move ~/.huskyrc to ~/.config/husky/init.sh for centralized configuration.husky install. Use husky or husky some/dir for the same functionality (deprecation notice to be added)..git is missing; it now triggers a warning instead of failure.HUSKY_DEBUG=1 with HUSKY=2 for debugging.ESM for module usage.v9 is backward compatible with v8, allowing you to freely upgrade and migrate your hooks later.
Here are the steps to migrate:
package.json
{
"scripts": {
- "prepare": "husky install"
+ "prepare": "husky"
}
}
.husky/pre-commit
- #!/usr/bin/env sh
- . "$(dirname -- "$0")/_/husky.sh"
npm test
Note: sh will be used to run hooks, even if a shebang is set.
If you were using husky as a module:
- const husky = require('husky')
- // ...
+ import husky from 'husky'
+ console.log(husky())
fix: add git not installed message #1208
docs: remove deprecated npm set-script
fix: use POSIX equality operator
docs: replace deprecated npx --no-install option with npx --no by @sibiraj-s in https://github.com/typicode/husky/pull/1070
husky - prefix to logged global error messages by @joshbalfour in https://github.com/typicode/husky/pull/1092PATH when command not found to improve debuggability$HUSKY=0/usr/bin/env sh instead of direct path of sh by @skhaz in https://github.com/typicode/husky/pull/1051./husky.sh by @hyperupcall in https://github.com/typicode/husky/pull/1104basename/dirname to treat $0 as an argument by @mataha in https://github.com/typicode/husky/pull/1132git.io links by @renbaoshuo in https://github.com/typicode/husky/pull/1136npx --no-install option with npx --no by @sibiraj-s in https://github.com/typicode/husky/pull/1070pnpm installation by @MohamadKh75 in https://github.com/typicode/husky/pull/1139_No changes. Husky v7.0.3 was reverted, this version is the same as v7.0.2._
No changes. Husky v7.0.3 was reverted, this version is the same as v7.0.2.
Nothing published for this version
Fix pre-commit hook in WebStorm
Fix pre-commit hook in WebStorm (#1023)
Fix gracefully fail if Git command is not found #1003 (same as in v6)
Improve .husky/ directory structure. __.husky/.gitignore is now unnecessary and can be removed__.
.husky/ directory structure. .husky/.gitignore is now unnecessary and can be removed.husky-init CLIhusky-4-to-7 CLIPlease help me develop and release OSS projects :heart: on GitHub Sponsors or Open Collective. Thank you for your support!
Husky 6 contains breaking changes. If you're coming from v4, npm install husky@6 won't be enough.
After being in early access for Open Source projects and Sponsors for a limited time, I'm happy to announce that husky 6 is MIT again and can be freely used in commercial projects! 🎉
Many thanks to the Open Source projects and Companies which have switched to/sponsored the new husky during this period!
OSS is my full-time job, please consider sponsoring the development of husky on GitHub sponsors or Open Collective. Thank you!
husky init has been moved to its own package (npx husky-init)require('husky')Husky 6 contains breaking changes. If you're coming from v4, npm install husky@6 won't be enough.
Recommended: see husky-4-to-6 CLI to automatically migrate your config. There's also a dedicated section in the docs.
If you're curious why config has changed, you may be interested in reading: https://blog.typicode.com/husky-git-hooks-javascript-config/
Also Husky 6 follows official npm and Yarn best practices regarding autoinstall. It's recommended to use prepare script instead (see usage in docs).
Add set command to replace hooks (husky set .husky/pre-commit cmd)
set command to replace hooks (husky set .husky/pre-commit cmd)add command to append command (husky add .husky/pre-commit cmd)docs: add specific Yarn v2 install/uninstall instructions
husky init will detect Yarn v2 and initialize accordinglydocs: recommend prepare script instead of postinstall
prepare script instead of postinstall (#890)husky init use prepare script (#890)style(shell): add trailing newlines
Nothing published for this version
fix(install): do not fail if not inside a Git directory (closes #851)
See https://github.com/typicode/husky/releases/tag/v5.0.0 for v5 release notes
fix(install): better handle Git <2.9 (#846) closes #844
fix(shell): double quote params
Nothing published for this version
Fix custom directory support #827
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
👉 See https://typicode.github.io/husky for breaking changes and new installation instructions.
👉 See https://typicode.github.io/husky for breaking changes and new installation instructions.
Husky 5 is released under The Parity Public License.
It doesn't affect you if you're using husky in an Open Source project or if you're a sponsor. You're free to use it as usual and I hope you'll enjoy this new release ❤️
If you're using husky in a commercial project, you may want to consider becoming a sponsor to support the project. You can also try it for 30 days.
This is only for a limited time, husky will be MIT again later.
Important Husky v5 brings a lot of improvements but is also very different from v4. Git hooks won't work if you only upgrade husky dependency, existing config needs to be migrated too.
The best way to switch to v5 is to follow the new installation instructions and migrate existing hooks command using husky add.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fix Cannot read property 'toString' of null
Cannot read property 'toString' of nullFix: upgrade find-versions to 4.0.0 https://github.com/typicode/husky/pull/837
Fix prepare-commit-msg on windows #737
prepare-commit-msg on windows #737Rollback and do not throw error if husky install fails
Throw error if husky install fails
INIT_CWD environment variableNothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →