从 v4 升级到 v9 需按文档迁移旧配置;依赖 npm 的 prepare 脚本自动安装钩子,需确保该脚本未被禁用
npm install --save-dev huskyREADME 未说明,纯 Node.js 工具,无 GPU 或显存要求
轻量零依赖的 Git hooks 工具,用 core.hooksPath 让提交前检查自动跑起来
用 npm 脚本轻松配置 Git hooks,在 commit、push 前自动跑 lint、测试等检查,省去手写 shell 脚本的麻烦。
核心能力
- 用 Git 原生 core.hooksPath 管理钩子
- gzip 后仅 2 kB 且无任何依赖
- 运行开销约 1ms,几乎不影响提交
- 支持全部 13 个客户端 Git 钩子
- 支持分支级钩子与 POSIX shell 脚本
容易踩的坑
- v9.1.7最新正式版2024-11-18 · 2024-11-18 15:27 UTC
What's Changed
- fix: add husky label to deprecated warning by @smackfu in https://github.com/typicode/husky/pull/1538
New Contributors
- @smackfu made their first contribution in https://github.com/typicode/husky/pull/1538
Full Changelog: https://github.com/typicode/husky/compare/v9.1.6...v9.1.7
- v9.1.62024-09-11 · 2024-09-11 22:14 UTC
查看更新说明
What's Changed
- Fix issue where example pre-commit file is generated incorrectly by @dexmlee in https://github.com/typicode/husky/pull/1519
New Contributors
- @OlegKipchatov made their first contribution in https://github.com/typicode/husky/pull/1495
- @Byron2016 made their first contribution in https://github.com/typicode/husky/pull/1499
- @dexmlee made their first contribution in https://github.com/typicode/husky/pull/1519
Full Changelog: https://github.com/typicode/husky/compare/v9.1.5...v9.1.6
- v9.1.52024-08-20 · 2024-08-20 12:37 UTC
查看更新说明
What's Changed
- fixes #1494, support
pre-merge-commithook by @RainMeoCat in https://github.com/typicode/husky/pull/1497
New Contributors
- @RainMeoCat made their first contribution in https://github.com/typicode/husky/pull/1497
Full Changelog: https://github.com/typicode/husky/compare/v9.1.4...v9.1.5
- fixes #1494, support
- v9.1.42024-07-29 · 2024-07-29 14:55 UTC
查看更新说明
- Improve deprecation notice
- v9.1.32024-07-26 · 2024-07-26 18:03 UTC
查看更新说明
- fix: better handle space in
PATH
- fix: better handle space in
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
husky
Modern native Git hooks made easy
Husky improves your commits and more 🐶 woof!
[!NOTE] Using React? See MistCSS typed CSS components.
Features
- Just
2 kB(📦 gzipped) with no dependencies - Fastest due to being lightweight (runs in
~1ms) - Uses new Git feature (
core.hooksPath) - Supports:
- macOS, Linux, Windows
- Git GUIs, Node version managers, custom hooks directory, nested projects, monorepos
- All 13 client-side Git hooks
And more:
- Branch-specific hooks
- Use POSIX shell to script advanced cases
- Adheres to Git's native hook organization
- Aligns with npm best practices using
preparescript - Opt-in/opt-out options
- User-friendly error messages
Changelog
Check out the v9 changelog to discover all the new and improved features!
Documentation
https://typicode.github.io/husky
Important Upgrading from v4 to v9 requires migrating previous config, please see the docs.
Sponsors
Support this project by becoming a sponsor here 💖