Lefthook: A Fast and Powerful Git Hooks Manager for Any Project

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Lefthook: A Fast and Powerful Git Hooks Manager for Any Project

Summary

Lefthook is a robust Git hooks manager written in Go, designed for speed and flexibility across various project types. It simplifies the process of enforcing code quality and consistency, supporting parallel execution and custom command configurations. This tool ensures your team's code stays in shape with minimal setup and powerful features.

Repository Information

Analyzed by OSRepos on December 31, 2025

Topics

Click on any tag to explore related repositories

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introduction

Lefthook, developed by Evil Martians, is an incredibly fast and powerful Git hooks manager. Written in Go, it provides a simple, dependency-free binary that works seamlessly in any environment, making it an ideal solution for managing pre-commit, pre-push, and other Git hooks. Whether you're working with Node.js, Ruby, Python, or other project types, Lefthook helps automate code quality checks and maintain consistency across your team.

Installation

Lefthook offers multiple installation methods to suit your development environment. Here are a few common ways to get started:

With Go (>= 1.25):

go install github.com/evilmartians/lefthook/v2@v2.0.13

With NPM:

npm install lefthook --save-dev

For Ruby:

gem install lefthook

For Python:

pipx install lefthook

For a comprehensive list of installation options, including apt, brew, and winget, please refer to the official installation guide.

Examples

Lefthook's power lies in its flexible configuration and diverse features. Here are some examples demonstrating its capabilities:

Parallel Execution

Speed up your hook execution by running commands in parallel. This is particularly useful for multiple independent checks.

pre-push:
  parallel: true

Flexible File Lists

Control which files are passed to your commands, using staged_files, all_files, or custom Git diff commands.

pre-commit:
  jobs:
    - name: lint frontend
      run: yarn eslint {staged_files}

    - name: lint backend
      run: bundle exec rubocop --force-exclusion {all_files}

    - name: stylelint frontend
      files: git diff --name-only HEAD @{push}
      run: yarn stylelint {files}

Glob and Regexp Filters

Filter the list of files using glob patterns or regular expressions to apply specific checks only where needed.

pre-commit:
  jobs:
    - name: lint backend
      glob: "*.rb" # glob filter
      exclude:
        - "*/application.rb"
        - "*/routes.rb"
      run: bundle exec rubocop --force-exclusion {all_files}

Support for Docker

Integrate Lefthook with your Docker environment to run commands inside containers.

pre-commit:
  jobs:
    - script: "good_job.js"
      runner: docker run -it --rm <container_id_or_name> {cmd}

Local Configuration Overrides

Use lefthook-local.yml to skip unnecessary commands or override configurations for specific development environments.

# lefthook-local.yml
pre-push:
  exclude_tags:
    - frontend
  jobs:
    - name: audit packages
      skip: true

Why Use Lefthook?

Lefthook stands out as a superior Git hooks manager due to several key advantages:

  • Speed: Written in Go, it's incredibly fast and supports parallel execution of commands.
  • Power: Offers fine-grained control over command execution, file filtering, and custom scripting.
  • Simplicity: A single, dependency-free binary that's easy to install and integrate into any project.
  • Flexibility: Supports various languages and environments, including Docker, and allows for local configuration overrides.
  • Maintainability: Helps enforce consistent code standards and automated checks across development teams.

Links

Related repositories

Similar repositories that may be relevant next.

Destructive Command Guard (dcg): Protecting AI Agents from Dangerous Commands

Destructive Command Guard (dcg): Protecting AI Agents from Dangerous Commands

July 11, 2026

The Destructive Command Guard (dcg) is a high-performance hook designed to prevent AI coding agents from executing dangerous git and shell commands. Built in Rust, dcg intercepts and blocks catastrophic operations like `git reset --hard` or `rm -rf`, offering clear explanations and safer alternatives. It provides a crucial safety layer for developers working with tools like Claude Code, Codex CLI, and GitHub Copilot.

ai-agentsclideveloper-tools
Froggit: A Modern, Minimalist Git TUI for Streamlined Workflow

Froggit: A Modern, Minimalist Git TUI for Streamlined Workflow

April 14, 2026

Froggit is a modern, minimalist Git Terminal User Interface (TUI) designed to simplify your Git workflow. It offers visual feedback, keyboard-driven controls, and seamless integration with your terminal, enhancing clarity and speed for common Git operations. Built with Go, Froggit provides a fast and efficient way to manage your repositories across Windows, Linux, and macOS.

devtoolsgitgit-tools
difftastic: A Structural Diff Tool That Understands Code Syntax

difftastic: A Structural Diff Tool That Understands Code Syntax

January 28, 2026

difftastic is an innovative structural diff tool designed to compare files based on their syntax rather than just lines. Written in Rust, it leverages tree-sitter to provide precise insights into code changes across over 30 programming languages. This tool is particularly useful for developers who need to understand the true semantic differences in their code, even after reformatting.

difftree-sitterRust
GitBundle: A Rust-Powered Self-Hosted Code Hosting Platform

GitBundle: A Rust-Powered Self-Hosted Code Hosting Platform

January 14, 2026

GitBundle is a modern, self-hosted code hosting and workflow automation platform built with Rust, emphasizing performance, security, and full control. It offers a streamlined workflow engine compatible with GitHub Actions syntax, making it ideal for teams requiring a reliable and fast self-hosted solution.

rustcicddocker

Source repository

Open the original repository on GitHub.

18 counted GitHub visits

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️