ScriptsApr 7, 2026·2 min read

Lefthook — Fast Git Hooks Manager in Go

Blazing-fast Git hooks manager written in Go. Run linters, formatters, and tests on git commit/push in parallel. Zero-dependency single binary. Replaces Husky + lint-staged. 5,000+ stars.

SC
Script Depot · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

# Install
npm install lefthook --save-dev
# Or: brew install lefthook

# Initialize
npx lefthook install
# lefthook.yml
pre-commit:
  parallel: true
  commands:
    lint:
      glob: "*.{ts,tsx}"
      run: npx biome check --write {staged_files}
    typecheck:
      glob: "*.{ts,tsx}"
      run: npx tsc --noEmit
    test:
      glob: "*.test.{ts,tsx}"
      run: npx vitest run --reporter=dot {staged_files}

pre-push:
  commands:
    audit:
      run: npm audit --production

Now git commit auto-runs lint + typecheck + test in parallel.


Intro

Lefthook is a blazing-fast Git hooks manager written in Go with 5,000+ GitHub stars. It runs linters, formatters, and tests on git commit and push in parallel — replacing Husky + lint-staged with a single, zero-dependency binary that starts in milliseconds. Configure once in lefthook.yml and every team member gets consistent code quality checks. Best for teams who want fast, reliable pre-commit hooks without Node.js runtime overhead. Works with: any git repository, any language. Setup time: under 2 minutes.


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 files

Skip 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-commit

Key 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.


🙏

Source & Thanks

Created by Evil Martians. Licensed under MIT.

lefthook — stars 5,000+

Thanks for making git hooks fast and painless.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets