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 |
| GrumPHP | Automates PHP code quality checks through configurable Git 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 |
| Autohook | Runs and organises Git hook scripts using a single Bash script |
| Jig | Git pre-commit hook on steroids |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |



Please read our Comment Policy before commenting.