Why Lefthook Over Husky
| Feature | Husky + lint-staged | Lefthook |
|---|---|---|
| Speed | ~500ms startup | ~5ms startup |
| Dependencies | Node.js required | Single Go binary |
| Parallel execution | No | Yes (built-in) |
| Config | .husky/ + lint-staged | Single lefthook.yml |
| Glob filtering | lint-staged | Built-in globs |
Parallel Execution
pre-commit:
parallel: true # All commands run simultaneously
commands:
lint: { run: "biome check {staged_files}" }
format: { run: "prettier --check {staged_files}" }
test: { run: "vitest run --changed" }3 commands run in parallel instead of sequentially.
Smart File Filtering
commands:
lint-ts:
glob: "*.{ts,tsx}" # Only TypeScript files
run: biome check {staged_files}
lint-py:
glob: "*.py" # Only Python files
run: ruff check {staged_files}
lint-go:
glob: "*.go" # Only Go files
run: golangci-lint run {staged_files}Staged Files Only
{staged_files} passes only the files you changed — no wasted work:
commands:
format:
glob: "*.{ts,tsx,js,jsx}"
run: biome check --write {staged_files}
stage_fixed: true # Re-stage auto-fixed filesSkip Hooks When Needed
git commit --no-verify -m "wip: quick save"CI-Friendly
Lefthook works in CI too:
# .github/workflows/hooks.yml
- run: npx lefthook run pre-commitKey Stats
- 5,000+ GitHub stars
- Written in Go (5ms startup)
- Parallel command execution
- Glob-based file filtering
- Zero Node.js dependency
FAQ
Q: What is Lefthook? A: A fast Git hooks manager that runs linters, formatters, and tests on commit/push in parallel, replacing Husky + lint-staged with a single binary.
Q: Is Lefthook free? A: Yes, open-source under MIT license.
Q: Can I use Lefthook without Node.js? A: Yes, install via Homebrew, Go, or download the binary directly.