Briefing

Speeding Up Git Hooks: Switching from Husky to Lefthook

ux
by Kelvyn Thai ·

Switch to Lefthook for faster, parallel pre‑commit hooks, moving heavy checks to pre‑push.

What to do now

Switch your pre‑commit hooks to Lefthook, configure lint and prettier in pre‑commit, and move type‑check and unit tests to pre‑push.

Summary

Husky’s pre‑commit hook runs lint, type‑check, and unit tests, taking about 17 seconds per commit.

Lefthook, written in Go, executes jobs in parallel and uses a simple YAML config, reducing the pre‑commit workload to lint and prettier on staged files.

Heavy checks like type‑check and unit tests are moved to a pre‑push hook, cutting overall commit time by roughly 10%.

The example config shows parallel jobs for lint and prettier in pre‑commit, and type‑check and test in pre‑push.

By splitting responsibilities, developers experience smoother, faster commits without sacrificing quality.

Lefthook’s performance and control come without added complexity, making it a compelling upgrade for any project.

Key changes

  • Lefthook written in Go for faster execution
  • Parallel job execution reduces overhead
  • Pre‑commit runs only lint and prettier on staged files
  • Pre‑push runs type‑check and unit tests
  • Commit time reduced by ~10%
  • Simplified YAML config improves maintainability

Affects

internal

Customer impact

Analyzing matches…

Ask about this story

Impact on an agency? Which customers? Compare historically Risks of waiting