Husky vs Lefthook
Husky vs Lefthook compared for 2026: Husky 9.1.7 (a 4 KB shell-based hook installer, usually paired with lint-staged 17.6) vs Lefthook 2.2.3 (a Go binary with parallel jobs, globs and stage_fixed). Includes install footprint, hook overhead, lint-and-format commit times, partial staging, CI behaviour and failure handling from runs we did on the same machine, plus a clear pick.
Quick Answer
Husky and Lefthook both install Git hooks for a team from a file committed to the repository, so every clone runs the same pre-commit and pre-push checks. Husky 9.1.7 is a 4 KB npm package with no dependencies: it points core.hooksPath at .husky/_ and runs plain shell files such as .husky/pre-commit, and most JavaScript projects add lint-staged 17.6.2 to run linters on staged files only. Lefthook 2.2.3 is a single Go binary configured with lefthook.yml that does the staged-file filtering, globbing, parallel or piped jobs and re-staging of fixed files itself, and it installs from npm, Go, RubyGems, PyPI, Homebrew and more. In our runs the hook managers themselves added no measurable time: a no-op hook cost less than about 15 ms per commit for both. A real eslint --fix plus prettier --write on 20 staged files took 1.15-1.23 s with Husky and lint-staged and 0.93-1.07 s with Lefthook, and both handled partial staging the same way, including the same edge-case bug. Pick Husky with lint-staged for JavaScript-only repositories that want the most familiar setup; pick Lefthook for polyglot or monorepo setups, or when you want one config file without Node in the hook path.
Last updated November 26, 2026. Covers Husky 9.1.7 with lint-staged 17.6.2 and Lefthook 2.2.3 (25 November 2026); package metadata, docs, changelogs and repository data read on 26 November 2026, plus same-machine install, overhead, lint-and-format, failure, partial-staging and CI install runs we did that day.
| Feature | Husky | Lefthook |
|---|---|---|
| Licence & Repository | MIT; typicode/husky, ~35.4k stars | MIT; evilmartians/lefthook, ~9.1k stars |
| Latest Release (Nov 2026) | 9.1.7 on 18 Nov 2024 (no 2025-2026 releases) | 2.2.3 on 25 Nov 2026 (npm); 2.0.0 on 20 Oct 2025 |
| Runtime / Implementation | Node package that writes POSIX shell shims; hooks run with sh | Single Go binary; shims are sh scripts |
| Install Channels | npm, pnpm, yarn, bun (devDependency + prepare script) | npm, go install / go tool, gem, pipx, brew, apt, rpm, winget and more |
| Where Hooks Are Defined | One shell file per hook in .husky/ (e.g. .husky/pre-commit) | lefthook.yml (+ lefthook-local.yml) |
| How Hooks Are Wired Into Git | git config core.hooksPath .husky/_ (14 shims written there) | lefthook install writes shims into .git/hooks |
| Staged-File Filtering | None built in; add lint-staged or a git diff --cached one-liner | {staged_files}, {all_files}, {push_files}, custom files command |
| Parallel / Sequential Jobs | Via lint-staged: different globs run concurrently, commands for one glob in sequence | parallel: true or piped: true per hook |
| Re-staging Auto-fixed Files | Via lint-staged (stages task changes automatically) | stage_fixed: true (pre-commit only; hook fails if git add fails since 2.1.12) |
| Partially Staged Files | Via lint-staged: unstaged changes hidden and restored | Hides unstaged changes and restores them (same result as lint-staged in our test) |
| Monorepo / Sub-directory Support | Custom hooks directory, e.g. prepare: cd .. && husky frontend/.husky | root: per job, glob filters, tags |
| Per-developer Overrides | ~/.config/husky/init.sh (runs before every hook) | lefthook-local.yml (exclude_tags, skip, overrides) |
| Skip / Disable | git commit -n, HUSKY=0 (also skips install) | git commit -n, LEFTHOOK=0, skip/only rules in config |
| Behaviour on npm install in CI | Installs hooks unless HUSKY=0 | npm postinstall skips hook install when CI is set (unless LEFTHOOK=1) |
| npm ci --omit=dev | prepare: husky fails with exit 127 (docs: husky || true or install.mjs) | Completes (no prepare script needed) |
| Release Activity (2026) | No releases since Nov 2024 | Frequent releases (2.1.x-2.2.3 in 2026) |
| Our Run: npm install footprint | 1 package, 44 KB (lint-staged adds 5 packages, ~169 KB unpacked for lint-staged) | 2 packages, 14 MB (platform binary) |
| Our Run: no-op hook overhead per commit | ~90-93 ms vs 77-84 ms with --no-verify | ~73-91 ms vs 77-84 ms with --no-verify |
| Our Run: eslint --fix + prettier on 20 files | 1.15-1.23 s (with lint-staged 17.6.2) | 0.93-1.07 s (piped, stage_fixed) |
| Our Run: eslint + prettier --check on 20 files | 0.80-0.98 s (two lint-staged globs, concurrent) | 0.74-0.94 s parallel; 0.91-0.98 s piped |
Husky
Husky is the most widely used Git hooks installer in the JavaScript ecosystem. Version 9 is deliberately minimal: running husky (normally from the npm prepare script) sets git config core.hooksPath to .husky/_, writes a small shim for each client-side hook there, and each shim runs your own POSIX shell file such as .husky/pre-commit if it exists. Husky adds node_modules/.bin to PATH, supports HUSKY=0 to disable it and HUSKY=2 for debug tracing, and sources ~/.config/husky/init.sh so Git GUIs can find Node version managers. It does not filter files or run jobs itself; most projects pair it with lint-staged, which runs commands on staged files and re-stages their fixes. Husky 9.1.7 was released on 18 November 2024, is MIT-licensed, has no dependencies, unpacks to 4,041 bytes and has about 35.4k GitHub stars.
Pros
- Tiny and dependency-free: one 4 KB package, 44 KB of node_modules in our install, installed in 0.32 s
- Hooks are plain shell scripts in .husky/, so anything you can write in sh works, with node_modules/.bin already on PATH
- Uses Git's own core.hooksPath, so uninstalling is git config --unset core.hooksPath and nothing in .git/hooks is touched
- The default pairing with lint-staged is the most documented setup in JavaScript projects; lint-staged backs up state and reverted cleanly when a linter failed in our test
- Hook overhead was within noise of a commit with --no-verify in our run (about 90 ms vs about 80 ms per commit including git add)
Cons
- No staged-file filtering, globbing or parallelism of its own: that needs lint-staged (17.6.2 requires Node 22.22.1 or newer) or hand-written shell
- Installs hooks in CI unless you set HUSKY=0: CI=true npm install still set core.hooksPath in our run
- A prepare script of plain husky fails npm ci --omit=dev with exit 127 because the package is a devDependency; the docs give workarounds
- No release since 9.1.7 in November 2024; the repository was last pushed in March 2026 and lists about 110 open issues and pull requests
- Node-centric: the npm prepare script is the install path, so Python, Ruby or Go repositories need Node just for hooks
Best For
JavaScript and TypeScript repositories that already use npm scripts, want hooks as plain shell files, and are happy to add lint-staged for staged-file linting.
Lefthook
Lefthook is a Git hooks manager from Evil Martians, written in Go and distributed as a single dependency-free binary. You describe hooks in lefthook.yml as jobs with run commands, glob and exclude filters, file templates such as {staged_files} and {all_files}, a working-directory root for monorepo packages, tags, and parallel or piped execution; stage_fixed re-adds files that a pre-commit job changed. lefthook install writes small shell shims into .git/hooks that locate the binary and call lefthook run. It installs from npm, Go, RubyGems, PyPI (pipx), Homebrew, apt, winget and other channels, and supports per-developer overrides in lefthook-local.yml. Lefthook 2.2.3 was published to npm on 25 November 2026 (GitHub release 24 November), is MIT-licensed and has about 9.1k GitHub stars.
Pros
- One config file does staged-file filtering, globs, excludes, parallel or piped jobs and re-staging, with no lint-staged needed
- Language-agnostic: the same lefthook.yml works in Node, Ruby, Python, Go or PHP repositories, installed through each ecosystem's package manager
- Fastest of our fix-and-restage runs: 0.93-1.07 s against 1.15-1.23 s for Husky with lint-staged on the same 20 files
- The npm postinstall skips installing hooks when CI is set, and npm ci --omit=dev completed with exit 0 in our run
- lefthook-local.yml and tags let a developer skip slow jobs locally without editing the shared config
- Very active: 2.2.0 to 2.2.3 shipped between October and November 2026, with fixes to stash handling and fixed-file staging
Cons
- The npm install pulls a platform binary package: 14 MB of node_modules on Linux x64 against 44 KB for Husky
- npm install runs lefthook install automatically and, in a fresh repo, wrote an example lefthook.yml and a prepare-commit-msg hook; set LEFTHOOK=0 or the new LEFTHOOK_NO_AUTO_INSTALL if you don't want that
- Commands are not looked up in node_modules/.bin for you; we used ./node_modules/.bin/eslint (or npx/yarn/pnpm) in run lines
- A job without a file filter was skipped on an empty commit ('no matching staged files'), which surprises people who use pre-commit for non-file checks
- 2.0 (October 2025) renamed CLI flags and dropped regexp excludes and skip_output, so old configs and blog posts need adjusting
Best For
Polyglot repositories and monorepos, teams that want hooks without depending on Node, and projects that want staged-file filtering, parallel jobs and re-staging in one YAML file.
Two designs: a shell installer versus a hook runner
Husky 9 does almost nothing at commit time, by design. Running husky sets core.hooksPath to .husky/_ and writes a shim for each client-side hook (we counted 14 executable files, from applypatch-msg to prepare-commit-msg). Each shim sources a shared script that exits early if your own .husky/<hook> file does not exist or HUSKY=0 is set, prepends node_modules/.bin to PATH and runs your file with sh -e. Everything else, from choosing files to running linters, is up to you. That is why husky init writes npm test into .husky/pre-commit and why most projects put lint-staged there: lint-staged reads a glob-to-command map from package.json, runs the commands on staged files only, re-adds what they changed, and keeps a backup git stash and hides unstaged edits while doing so (lint-staged 17 needs Node 22.22.1 and Git 2.32 or newer). Lefthook moves all of that into one binary. lefthook install writes shims into .git/hooks that find the binary (the shim tries PATH, the npm platform package, go tool, bundle exec, yarn, pnpm, uv run, mise and others) and call lefthook run <hook>. The YAML then defines jobs with run commands, glob and exclude filters, file templates, root directories, tags, and parallel or piped execution. The practical difference is where complexity lives: in Husky setups it is spread across shell files, package.json and lint-staged config; in Lefthook it sits in lefthook.yml.
What we measured: install, overhead and real commits
On 26 November 2026 we ran both in the cloud sandbox (2 vCPUs, Node 22.23.5, Git 2.43.0, eslint 10.15.0, prettier 3.10.1). npm install took 0.32 s for Husky (one package, 44 KB) and 1.01 s for Lefthook (two packages, 14 MB, almost all of it the lefthook-linux-x64 binary). Adding lint-staged 17.6.2 to the Husky project added five packages. To isolate the managers, we made 30 commits each with a hook that only ran true: commits with --no-verify averaged 77-84 ms including the git add, Husky 90-93 ms and Lefthook 73-91 ms across three rounds, so neither adds anything you would notice; claims that one manager is 'twice as fast' do not come from the manager itself. Then the real job: a 60-file repository where each commit changed 20 files with unformatted code, and the hook ran eslint --fix then prettier --write and re-staged the results. Husky with lint-staged took 1.15-1.23 s per commit and Lefthook with piped jobs and stage_fixed took 0.93-1.07 s (eslint about 0.44 s and prettier about 0.42 s of that, per Lefthook's summary). Both left a clean working tree and commits that passed both tools. In a check-only variant, Lefthook's parallel mode took 0.74-0.94 s, its piped mode 0.91-0.98 s, and lint-staged with two concurrent globs 0.80-0.98 s; on two cores parallelism barely matters.
Failures and partially staged files
When eslint failed on a staged syntax error, both blocked the commit with exit code 1 and left the files as they were. lint-staged printed that it was reverting to the original state and cleaning up its temporary files; Lefthook, in piped mode, skipped the prettier job after the eslint failure and reported the eslint output. The more interesting test is a file with staged and unstaged changes in it, which is where hook tools have historically lost work. We staged a new unformatted function at the top of a file and then edited a line further down without staging it. Both tools committed only the staged function, formatted by prettier, and put the unstaged edit back in the working tree, correctly shifted by the two lines that formatting added. We then repeated it with the unstaged change being a new line appended at the very end of the file. Here both tools produced the same wrong result: the restored line landed two lines too early, inside the last function, and the working-tree file no longer parsed. Nothing was lost and the commit itself was correct, but it shows that both re-apply unstaged changes as a patch with context matching, and that end-of-file edits next to a reformatted region are the case to watch. Lefthook's changelog shows recent work in this area: 2.1.16 added preserving unrelated unstaged changes on conflict and 2.2.2 cleans up only its own stash.
CI, production installs and day-to-day switches
The install-time behaviour differs more than the commit-time behaviour. Husky installs whenever the prepare script runs, and it does not look at CI: in our run, CI=true npm install still set core.hooksPath, while HUSKY=0 npm install printed 'HUSKY=0 skip install'. The docs recommend HUSKY: 0 in CI environments for that reason. They also warn that installing only production dependencies breaks a plain prepare: husky script, and we reproduced it: npm ci --omit=dev failed with exit 127 because husky was not installed. The documented fixes are husky || true or a small .husky/install.mjs that exits in production and CI. Lefthook's npm package installs hooks from a postinstall script that returns early when CI is set (unless LEFTHOOK is set to a truthy value), and npm ci --omit=dev finished with exit 0. The flip side is that npm install of lefthook ran lefthook install immediately: in a fresh repository it wrote a commented example lefthook.yml and installed a prepare-commit-msg hook before we had configured anything. 2.2.3 adds a LEFTHOOK_NO_AUTO_INSTALL variable. Day to day, both honour git commit -n, both skip silently with HUSKY=0 or LEFTHOOK=0, and Husky's ~/.config/husky/init.sh is the place to load nvm or fnm for Git GUIs.
Limits, migration and when not to use each
Do not choose Husky alone and expect staged-file linting: without lint-staged or a shell one-liner it runs your commands on the whole project or on nothing. Do not choose Husky for repositories where Node is not otherwise needed; installing Node to get Git hooks into a Go or Python project is the wrong trade, and Lefthook installs from go, pipx or gem instead. Be aware that Husky has not had a release since November 2024; it is small and stable, but bug fixes are not arriving. Do not choose Lefthook if your team cannot accept a 14 MB platform binary in node_modules, or if your pre-commit hook mainly runs checks that are not tied to files, unless you mark them so they run without staged files. Remember that run lines in lefthook.yml are not given node_modules/.bin automatically. Migration is mostly mechanical. A typical Husky setup of .husky/pre-commit running lint-staged with {'*.js': ['eslint --fix', 'prettier --write']} becomes one Lefthook pre-commit hook with piped: true and two jobs on glob '*.js' with {staged_files} and stage_fixed: true; then remove core.hooksPath (git config --unset core.hooksPath) so Git reads .git/hooks again, which Husky's troubleshooting page also calls out. Both tools are free and MIT-licensed.
Verdict
Pick Lefthook for new setups unless you have a reason not to. One lefthook.yml covers what Husky needs lint-staged for (staged-file filtering, globs, parallel or piped jobs and re-staging fixes), it works the same in JavaScript, Ruby, Python and Go repositories, it skips hook installation in CI on its own, and it does not break npm ci --omit=dev. It was also the quicker of the two in our lint-and-format commit, by roughly 0.1-0.2 s on 20 files, though that gap comes from lint-staged's bookkeeping rather than from the hook manager, and both managers added no measurable overhead. Pick Husky with lint-staged when the repository is JavaScript-only, the team already knows that setup, and you want hooks as plain shell files with a 4 KB dependency; just set HUSKY=0 in CI and harden the prepare script. If you already run Husky and lint-staged without problems, there is little to gain from migrating: both handled failing linters and partially staged files the same way in our tests, including the same edge case where an unstaged line at the end of a reformatted file came back in the wrong place.