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·6 months ago
#dBQeCqlE
#lefthook#husky#git#webdev#commit
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.