evilmartians/lefthook β the git hooks manager that doesn't require a runtime in your project
Install (macOS, Linux, or via go install β no runtime required)
curl -1sLf "https://dl.lefthook.com/latest/install.sh" | bash
macOS: brew install lefthook
go: go install github.com/evilmartians/lefthook@latest
Init in any repo
lefthook install
Example lefthook.yml β runs lint and format-check in parallel before every commit
cat > lefthook.yml << 'EOF'
pre-commit:
parallel: true
commands:
lint:
run: ./scripts/lint.sh {staged_files}
fmt:
run: ./scripts/fmt_check.sh {staged_files}
EOF
Lefthook reads {staged_files} and passes only modified files to each command