# evilmartians/lefthook

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/evilmartians-lefthook).**

7,598 stars · 265 forks · Go · mit

## Links

- GitHub: https://github.com/evilmartians/lefthook
- Homepage: http://lefthook.dev/
- awesome-repositories: https://awesome-repositories.com/repository/evilmartians-lefthook.md

## Topics

`git` `go` `golang` `hacktoberfest` `hooks` `lefthook` `manager`

## Description

Lefthook is a Git hook manager and workflow automation tool designed to execute user-defined scripts during version control events. It automates the execution of linters, tests, and formatters to validate changes and maintain code quality before commits or pushes.

The project distinguishes itself through a parallel execution model that runs multiple shell commands concurrently to reduce latency. It supports complex configuration management, including the ability to merge global, remote, and local settings and synchronize configurations from external repositories to standardize development environments across teams.

Its broader capabilities cover command-line automation, such as commit message validation and automatic file staging. The tool also provides advanced filtering for hook execution based on glob patterns, file types, or branch names, and includes specialized support for monorepo structures via subdirectory script execution.

Lefthook is distributed as a standalone binary and is available via various package managers, with integration support for Devbox and the Swift Package Manager.

## Tags

### Development Tools & Productivity

- [Git Hook Definitions](https://awesome-repositories.com/f/development-tools-productivity/git-hook-definitions.md) — Defines automation steps and scripts to execute during Git events via structured configuration files. ([source](https://lefthook.dev/configuration/index))
- [Git Hook Managers](https://awesome-repositories.com/f/development-tools-productivity/git-hook-managers.md) — Automates the installation and execution of Git hooks to validate or modify the development workflow. ([source](https://lefthook.dev/configuration/Scripts))
- [Configuration Layering Systems](https://awesome-repositories.com/f/development-tools-productivity/configuration-layering-systems.md) — Merges global, remote, and local configuration files to support environment-specific overrides of hook behaviors.
- [Input Filtering](https://awesome-repositories.com/f/development-tools-productivity/execution-hooks/hook-execution-rules/input-filtering.md) — Restricts hook execution to specific files using glob patterns and file type filters. ([source](https://lefthook.dev/examples/filters/))
- [File Filtering Utilities](https://awesome-repositories.com/f/development-tools-productivity/file-filtering-utilities.md) — Restricts files passed to commands using glob patterns and skips execution when no matches are found. ([source](https://lefthook.dev/configuration/glob/))
- [Parallel Command Execution](https://awesome-repositories.com/f/development-tools-productivity/parallel-command-execution.md) — Executes multiple commands and scripts concurrently to significantly reduce total execution time. ([source](https://lefthook.dev/configuration/parallel/))
- [Parallel Execution](https://awesome-repositories.com/f/development-tools-productivity/parallel-execution.md) — Runs multiple shell commands concurrently using a worker model to reduce total workflow latency.
- [Pre-commit Hooks](https://awesome-repositories.com/f/development-tools-productivity/pre-commit-hooks.md) — Automates the execution of linters, tests, and formatters as quality checks before commits.
- [Shell Script Execution Engines](https://awesome-repositories.com/f/development-tools-productivity/shell-script-execution-engines.md) — Executes specified shell scripts or commands as part of a workflow to automate quality checks. ([source](https://lefthook.dev/configuration/Commands/))
- [Configuration-Defined Scripts](https://awesome-repositories.com/f/development-tools-productivity/terminal-shell-cli/cli-tooling-frameworks/cli-scripts/configuration-defined-scripts.md) — Maps version control events to user-defined scripts via YAML or JSON configuration files.
- [Argument Injection Utilities](https://awesome-repositories.com/f/development-tools-productivity/argument-injection-utilities.md) — Substitutes command templates with real-time data such as staged files or hook arguments during execution. ([source](https://lefthook.dev/configuration/run))
- [CLI Output Controllers](https://awesome-repositories.com/f/development-tools-productivity/cli-output-controllers.md) — Filters console logs and suppresses standard output to only show errors during hook execution. ([source](https://lefthook.dev/configuration/output/))
- [Task Runner Extensions](https://awesome-repositories.com/f/development-tools-productivity/cli-task-runners/task-runner-extensions.md) — Supports executing tasks in different environments, including native shells and containers. ([source](https://cdn.jsdelivr.net/gh/evilmartians/lefthook@master/README.md))
- [Hook Argument Injection](https://awesome-repositories.com/f/development-tools-productivity/command-argument-parsers/cli-argument-definitions/positional-argument-configurations/hook-argument-injection.md) — Appends custom arguments or templates to commands to modify script behavior or override configurations. ([source](https://lefthook.dev/configuration/args/))
- [Commit Message Validation](https://awesome-repositories.com/f/development-tools-productivity/commit-message-generators/commit-message-validation.md) — Checks commit messages against a predefined set of rules to ensure they follow a consistent format. ([source](https://lefthook.dev/examples/commitlint/))
- [Configuration Importing](https://awesome-repositories.com/f/development-tools-productivity/configuration-importing.md) — Downloads and merges configuration files from external repositories to share setup across projects. ([source](https://lefthook.dev/examples/remotes/))
- [Dynamic File Target Selection](https://awesome-repositories.com/f/development-tools-productivity/custom-file-extension-analysis/dynamic-file-target-selection.md) — Executes custom shell commands to determine which files or directories should be passed to a hook. ([source](https://lefthook.dev/configuration/files/))
- [Environment Configuration](https://awesome-repositories.com/f/development-tools-productivity/environment-configuration.md) — Loads custom configuration files via environment variables to modify behavior without changing version-controlled settings. ([source](https://lefthook.dev/usage/envs/LEFTHOOK_CONFIG/))
- [Index Staging Operations](https://awesome-repositories.com/f/development-tools-productivity/file-indexing-utilities/staged-file-indexers/index-staging-operations.md) — Automatically adds modified files to the Git index after a script completes to ensure changes are committed. ([source](https://lefthook.dev/configuration/stage_fixed/))
- [Git Hook Bypassing Mechanisms](https://awesome-repositories.com/f/development-tools-productivity/git-hook-bypassing-mechanisms.md) — Allows users to temporarily skip the execution of configured hooks using environment variables. ([source](https://lefthook.dev/usage/envs/LEFTHOOK/))
- [Binary Shims](https://awesome-repositories.com/f/development-tools-productivity/git-hook-managers/binary-shims.md) — Implements a lightweight binary shim in the git hooks directory to delegate execution to the main manager.
- [Manual Task Triggering](https://awesome-repositories.com/f/development-tools-productivity/manual-task-triggering.md) — Allows running specific groups of commands or custom tasks on demand via the CLI. ([source](https://cdn.jsdelivr.net/gh/evilmartians/lefthook@master/README.md))
- [Subdirectory Script Execution](https://awesome-repositories.com/f/development-tools-productivity/monorepo-managers/subdirectory-script-execution.md) — Supports monorepo structures by allowing script execution within specific subdirectories.
- [Local Overrides](https://awesome-repositories.com/f/development-tools-productivity/project-scaffolding-config-code-generation/project-scaffolding-configuration/build-configuration/typescript-configurations/project-settings/local-overrides.md) — Supports user-specific configuration files that override global project settings to isolate developer environments. ([source](https://cdn.jsdelivr.net/gh/evilmartians/lefthook@master/README.md))
- [Local Hook Configuration Overrides](https://awesome-repositories.com/f/development-tools-productivity/project-scaffolding-config-code-generation/project-scaffolding-configuration/build-configuration/typescript-configurations/project-settings/local-overrides/local-hook-configuration-overrides.md) — Enables the creation of secondary configuration files for hooks that remain local to the machine. ([source](https://lefthook.dev/configuration/))
- [Real-Time Output Streaming](https://awesome-repositories.com/f/development-tools-productivity/real-time-output-streaming.md) — Displays the standard output of running scripts in real time rather than waiting for completion. ([source](https://lefthook.dev/configuration/follow/))
- [Remote Configuration Synchronization](https://awesome-repositories.com/f/development-tools-productivity/remote-file-synchronization/remote-configuration-synchronization.md) — Fetches the latest configuration from a remote source on every execution to keep scripts up to date. ([source](https://lefthook.dev/configuration/refetch/))
- [Script Management Tools](https://awesome-repositories.com/f/development-tools-productivity/script-management-tools.md) — Allows specifying a directory for script files excluded from version control to enable machine-specific automation. ([source](https://lefthook.dev/configuration/source_dir_local/))
- [Task Filtering](https://awesome-repositories.com/f/development-tools-productivity/task-execution/task-filtering.md) — Assigns labels to commands to selectively include or exclude tasks during the execution of hooks. ([source](https://lefthook.dev/configuration/tags/))
- [Task Tagging Systems](https://awesome-repositories.com/f/development-tools-productivity/task-tagging-systems.md) — Assigns labels to commands to allow selective execution or exclusion of related tasks. ([source](https://cdn.jsdelivr.net/gh/evilmartians/lefthook@master/README.md))
- [Scripted Interaction Prompts](https://awesome-repositories.com/f/development-tools-productivity/terminal-automation/interaction-scripting/scripted-interaction-prompts.md) — Connects executed scripts to the terminal TTY to support real-time user interaction and prompts. ([source](https://lefthook.dev/configuration/interactive/))
- [Command Configuration Overrides](https://awesome-repositories.com/f/development-tools-productivity/terminal-shell-cli/cli-tooling-frameworks/cli-tooling/argument-configuration-management/command-configurations/command-configuration-overrides.md) — Allows local overrides of global command definitions to adapt execution environments for specific users. ([source](https://lefthook.dev/examples/wrap-commands/))
- [Working Directory Configuration](https://awesome-repositories.com/f/development-tools-productivity/working-directory-configuration.md) — Controls the filesystem context for task execution and filters file paths to optimize hook runs. ([source](https://lefthook.dev/configuration/root/))

### DevOps & Infrastructure

- [Configuration Merging](https://awesome-repositories.com/f/devops-infrastructure/configuration-management/file-based-configuration/configuration-file-loading/configuration-merging.md) — Combines local and external configuration files using glob patterns to share and synchronize settings across teams. ([source](https://lefthook.dev/configuration/extends/))
- [Commit Message Generation](https://awesome-repositories.com/f/devops-infrastructure/commit-message-generation.md) — Prompts users to create structured commit messages based on specific conventions to maintain project history. ([source](https://lefthook.dev/examples/commitlint/))
- [Conditional Command Executions](https://awesome-repositories.com/f/devops-infrastructure/conditional-command-executions.md) — Runs specific commands or hooks only when defined conditions are met, such as matching a branch pattern. ([source](https://lefthook.dev/configuration/only/))
- [Sequential and Parallel Job Groups](https://awesome-repositories.com/f/devops-infrastructure/job-scheduling/group-execution-control/sequential-and-parallel-job-groups.md) — Executes sets of scripts simultaneously or sequentially with shared environment settings to coordinate complex steps. ([source](https://lefthook.dev/configuration/group/))

### Operating Systems & Systems Programming

- [Command Argument Templates](https://awesome-repositories.com/f/operating-systems-systems-programming/system-administration-maintenance/file-system-management/file-systems/file-template-generators/command-argument-templates.md) — Substitutes placeholders in commands with real-time data like staged or tracked file paths. ([source](https://lefthook.dev/configuration/run/))
- [Environment Variable Configurations](https://awesome-repositories.com/f/operating-systems-systems-programming/system-administration-maintenance/system-administration-utilities/system-utilities/environment-configuration-tools/system-environment-customizers/environment-variable-configurations.md) — Defines custom environment variables and extends the system path to ensure scripts have necessary tool access. ([source](https://lefthook.dev/configuration/env/))

### Software Engineering & Architecture

- [Monorepo Script Coordination](https://awesome-repositories.com/f/software-engineering-architecture/monorepo-script-coordination.md) — Executes commands within specified relative paths to support monorepo structures and separated folders. ([source](https://cdn.jsdelivr.net/gh/evilmartians/lefthook@master/README.md))
- [Hook Execution Skipping](https://awesome-repositories.com/f/software-engineering-architecture/conditional-branching/hook-execution-skipping.md) — Provides mechanisms to prevent specific scripts from running based on the active branch or system state. ([source](https://lefthook.dev/configuration/skip/))
- [Development Environment Standardization](https://awesome-repositories.com/f/software-engineering-architecture/development-environment-standardization.md) — Enables team-wide consistency by sharing and synchronizing hook configurations via remote files.
- [Execution Failure Policies](https://awesome-repositories.com/f/software-engineering-architecture/execution-failure-policies.md) — Halts the execution of subsequent commands in a sequence if any single task fails. ([source](https://lefthook.dev/configuration/piped/))
- [Execution Filters](https://awesome-repositories.com/f/software-engineering-architecture/type-safe-data-handling/type-inference-engines/file-type-inference/execution-filters.md) — The tool executes specific scripts based on file properties such as MIME types or binary status. ([source](https://lefthook.dev/configuration/file_types/))

### Data & Databases

- [Command](https://awesome-repositories.com/f/data-databases/custom-data-fields/template-injection/command.md) — Substitutes placeholders in command strings with real-time data such as staged file paths before execution.

### Programming Languages & Runtimes

- [Git Ref-Based Execution Filters](https://awesome-repositories.com/f/programming-languages-runtimes/script-execution-environments/git-ref-based-execution-filters.md) — Limits the execution of hooks to specific branches or tags to prevent scripts from running in unwanted environments. ([source](https://lefthook.dev/configuration/ref/))

### Testing & Quality Assurance

- [Worktree State Enforcement](https://awesome-repositories.com/f/testing-quality-assurance/worktree-state-enforcement.md) — Triggers a non-zero exit status when tracked files are modified to signal failure in CI environments. ([source](https://lefthook.dev/configuration/fail_on_changes/))
