A command-line prose linter that enforces your team's writing style rules in editors, CI, and code, running offline.
evilmartians/lefthook
A fast Git hooks manager written in Go that runs pre-commit and other hook commands in parallel across Node.js, Ruby, Python and other projects.
Open-source alternative to:Husky
- Stars
- 8,931
- Forks
- 325
- Open issues
- 91
- Last commit
- yesterday
What is it?
Lefthook manages Git hooks for a project through a single lefthook.yml file. You define commands for hooks such as pre-commit, pre-push or commit-msg, then run lefthook install once to wire them into the repository. It is distributed as a single dependency-free binary and can also be installed through npm, gem, pipx, Go, Homebrew, apt, winget and other package managers.
Each hook can run jobs in parallel and filter the files they receive using glob patterns, exclusions, or the list of staged files. Jobs can be grouped with tags, can run inside a subdirectory via root, can execute script files, and can run through a runner such as docker run. A local override file (lefthook-local.yml) lets individual developers skip or change jobs without touching the shared configuration.
Beyond hooks, commands defined in the config can be run directly with lefthook run, which is useful for shared fixers or linters. Output can be trimmed to only execution and failure messages.
Key features
- 01Runs hook commands in parallel to shorten pre-commit and pre-push checks.
- 02Filters files per job with glob patterns, exclusions and staged-file lists.
- 03Groups jobs with tags and can include or exclude them per hook.
- 04Supports running jobs in subdirectories, script files and Docker containers.
- 05Lets developers keep personal overrides in a local config file.
Use cases
- Running ESLint, Stylelint or RuboCop on staged files before each commit.
- Auditing dependencies or running security checks before a push.
- Enforcing commit message templates with a commit-msg script.
- Sharing a team-wide set of fixers that can be run on demand with lefthook run.
Quick start
- 1
Install lefthook with npm as a dev dependency
npm install lefthook --save-dev - 2
Configure your hooks in lefthook.yml
- 3
Install the hooks into the Git project
lefthook install
Things to know
- Some configuration and usage details are only on the external documentation site.
Topics
FAQ
- What is lefthook?
- A fast Git hooks manager written in Go that runs pre-commit and other hook commands in parallel across Node.js, Ruby, Python and other projects. Lefthook manages Git hooks for a project through a single lefthook.yml file. You define commands for hooks such as pre-commit, pre-push or commit-msg, then run lefthook install once to wire them into the repository. It is distributed as a single dependency-free binary and can also be installed through npm, gem, pipx, Go, Homebrew, apt, winget and other package managers.
- Is lefthook free to use? What license does it have?
- lefthook is open source under the MIT license. Check the license terms before using it in commercial products.
- Is lefthook still maintained?
- Actively maintained. The last commit to lefthook was on Oct 21, 2026.
- What can I use lefthook for?
- Running ESLint, Stylelint or RuboCop on staged files before each commit. Auditing dependencies or running security checks before a push. Enforcing commit message templates with a commit-msg script. Sharing a team-wide set of fixers that can be run on demand with lefthook run.
- How do I install lefthook?
- Install lefthook with npm as a dev dependency: npm install lefthook --save-dev Configure your hooks in lefthook.yml Install the hooks into the Git project: lefthook install
- Where can I get lefthook?
- The source code and installation instructions are on GitHub: https://github.com/evilmartians/lefthook
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Python utility and library that automatically sorts and groups your import statements.
An agent skill that turns AI-generated working-tree changes into clean Conventional Commits, branches, safe pulls and pushes, and GitHub PRs.
A native macOS menu bar app that shows GitHub repository status for issues, pull requests, CI, releases and local checkouts.
A small, hook-based state-management library for React with no providers required.
A cat(1) clone for the terminal with syntax highlighting, Git change markers, and automatic paging.