Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsApr 7, 2026·2 min de lecture

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.

Introduction

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 et remerciements

Created by Evil Martians. Licensed under MIT.

lefthook — stars 5,000+

Thanks for making git hooks fast and painless.

Discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires