Menu

Save 10% on Every Git Commit by Migrating from Husky to Lefthook
πŸ–ΌοΈ

Save 10% on Every Git Commit by Migrating from Husky to Lefthook

DEV CommunityΒ·Kelvyn ThaiΒ·7 months ago
#dBQeCqlE
#lefthook#husky#git#webdev#commit
Long article (266 words) β€” no AI summary yet.
Reading 0:00
15s threshold

Recently, I migrated our project from Husky to Lefthook β€” and the difference was immediately noticeable.

πŸ€” Why Lefthook?

A few key reasons:

⚑ Written in Go β†’ extremely fast execution

πŸ”€ Parallel execution β†’ run tasks concurrently instead of sequentially

🧩 Simple & powerful config β†’ less boilerplate, easier to maintain

🧠 Smarter workflow control β†’ flexible hook-level optimization

βΈ»

⏱️ Real impact (our case)

Before (Husky)

Pre-commit runs everything:

lint

type-check

unit tests

⏳ ~17 seconds per commit

After (Lefthook)

pre-commit:

only lint + prettier on staged files

pre-push:

type-check + unit tests

πŸ‘‰ Result:

⏱️ ~2s faster per commit (~10% improvement)

πŸ’‘ Much smoother dev experience (less waiting, more flow)

βΈ»

🧠 Key takeaway

Don’t overload your pre-commit hook.

Split responsibilities:

βœ… Fast checks β†’ pre-commit

πŸ” Heavy validation β†’ pre-push / CI

πŸ“¦ Example Lefthook config (simplified)

--- # https://lefthook.dev/configuration/glob_matcher/ glob_matcher : doublestar #…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.