Lefthook is a Git hooks manager for projects written in Node.js, Ruby, Python, Go and many other programming languages. It helps developers automate checks that run during Git operations, without having to maintain individual hook scripts by hand.
Git hooks are useful for catching mistakes before changes enter a repository, but they can become difficult to manage across a team. Lefthook provides a central configuration that describes which commands should run, when they should execute and which files they should examine.
Lefthook is distributed as a standalone executable without runtime dependencies. It can be used in small projects with a handful of checks or larger repositories with separate frontend, backend and testing workflows.
This is free and open source software.
Key Features
- Manages Git hooks including pre-commit, pre-push and commit-msg, automatically installing the necessary hook scripts.
- Supports parallel execution of independent commands and scripts to reduce the time spent waiting for checks to complete.
- Lets commands operate on staged files, all repository files or a custom selection determined by Git commands.
- Filters files using glob patterns and regular expressions, with exclusions for files that should not be processed.
- Runs commands in specified subdirectories, making it suitable for monorepositories containing multiple applications.
- Supports inline commands and external scripts, with configurable interpreters and the ability to run commands inside containers.
- Organises commands with tags, allowing groups of checks to be selectively enabled or excluded.
- Accepts configuration files in YAML, TOML, JSON and JSONC formats.
- Supports separate local configuration files for developer-specific overrides without modifying the shared project configuration.
- Runs individual hook groups manually using lefthook run, and supports custom task groups outside standard Git hooks.
- Offers configuration validation and inspection commands, including lefthook validate and lefthook dump.
- Provides control over command output, failure reporting and the ability to skip selected tasks when necessary.
Website: github.com/evilmartians/lefthook
Support:
Developer: Evil Martians
License: MIT License
lefthook is written in Go. Learn Go with our recommended free books and free tutorials.
Related Software
| Git Hook Managers | |
|---|---|
| lefthook | Git hooks manager for Node.js, Ruby, Python and more |
| husky | Git hooks made easy |
| pre-commit | Manage and maintain multi-language pre-commit hooks |
| prek | Reimagined version of pre-commit |
| overcommit | Manage and configure Git hooks |
| hk | Git hooks manager and project linting tool focusing on performance |
| simple-git-hooks | Simple git hooks manager for small projects |
| CaptainHook | Flexible Git hook manager |
| Githooks | Platform-independent hooks manager |
| git-hooks | Rewritten from icefox/git-hooks, with extra features |
| Jig | Git pre-commit hook on steroids |
Read our verdict in the software roundup.
Explore our carefully curated directory of recommended free and open source software, covering every major software category.The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more. Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form. |



Please read our Comment Policy before commenting.