unstale

npm / lefthook

lefthook

What changed in lefthook 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.

7 breaking12 new APIs and options1 performance11 behavior and defaults1 tooling44 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

lefthook 276 changes

Breaking changes 7

  • Color blending is removed.

    2.1.15release notes

  • The hook now fails when staging fixed files errors.

    2.1.12release notes

  • The minimum required Go version was updated.

    2.1.3release notes

  • Custom hooks are no longer installed to the hooks directory.

    2.0.14release notes

  • Custom templates are no longer escaped in command replacement.

    2.0.8release notes

  • Support for exclude regexp has been dropped.

    2.0.0release notes

  • The deprecated skip_output option is no longer supported.

    2.0.0release notes

New APIs and options 12

  • Packaging now supports Android.

    2.2.2release notes

  • Adds support for PHP Composer.

    2.2.1release notes

  • Adds integration with AI coding agents.

    2.1.10release notes

  • Introduces a setup hook option.

    2.1.2release notes

  • Allows installing hooks in non-Git repositories.

    2.1.0release notes

  • A timeout argument was added.

    2.0.16release notes

  • JSONC support was added, allowing configuration in JSONC format.

    2.0.14release notes

  • Adds the ability to show a diff when failing on changes.

    2.0.12release notes

  • Adds no_auto_install to lefthook.yml to control automatic installation.

    2.0.10release notes

  • Scripts can now accept optional arguments, allowing developers to pass arguments when using them.

    2.0.5release notes

  • Adds an optional standard glob matcher, doublestar, for configuring glob matching.

    2.0.4release notes

  • Adds the fail_on_changes option for non-CI environments.

    2.0.3release notes

Performance 1

  • A ghost hook is skipped when hooks are already configured.

    2.0.16release notes

Behavior and default changes 11

  • Install no longer writes an install-time lefthook path into AI hook configs.

    2.2.0release notes

  • Push files are diffed against the merge base with the default branch.

    2.1.17release notes

  • Forced colors are propagated to hook commands via CLICOLOR_FORCE.

    2.1.15release notes

  • Hints from lefthook install are less verbose.

    2.1.1release notes

  • Checks core.hooksPath when installing hooks.

    2.1.0release notes

  • Python wheels now contain one binary per platform.

    2.0.16release notes

  • Scripts are skipped when arguments are given with an empty file template.

    2.0.15release notes

  • Refetches and cleans up when the ref changes.

    2.0.11release notes

  • Lefthook now prefers using the executable found in $PATH.

    2.0.7release notes

  • Hooks now save the original executable location.

    2.0.6release notes

  • Windows uses sh as the command executor.

    2.0.0release notes

Tooling 1

  • Adds rudimentary shell completions for Lefthook commands.

    2.0.11release notes

Fixes and other changes 44

  • Cleanup now removes only the current stash hash, avoiding cleanup of other stashes.

    2.2.2release notes

  • Generates different patch names when running in a worktree.

    2.2.1release notes

  • The flag now ignores a trailing NUL.

    2.2.0release notes

  • The --output path is now passed to git diff as a single argument.

    2.2.0release notes

  • Submodules are no longer hashed when checking fail_on_changes.

    2.1.17release notes

  • Preserves unrelated unstaged changes when a conflict occurs.

    2.1.16release notes

  • Fixes staging fixed files when files are partially staged.

    2.1.16release notes

  • Paths in the generated hook shim are quoted.

    2.1.15release notes

  • Stdin is no longer piped into the post-checkout git-lfs hook.

    2.1.15release notes

  • The push-files fallback now resolves against the remote-tracking ref.

    2.1.15release notes

  • Fixed precedence for LEFTHOOK_OUTPUT.

    2.1.12release notes

  • PTY commands inherit the terminal size.

    2.1.11release notes

  • Updates the hooks path after resetting.

    2.1.9release notes

  • Lefthook no longer warns when the local hooks path equals the default hooks path.

    2.1.8release notes

  • Colors are changed to provide contrast.

    2.1.7release notes

  • The fallback push branch is separated from pathspecs.

    2.1.7release notes

  • The stage_fixed behavior is applied only when it is safe.

    2.1.7release notes

  • Unstaged changes are now always restored, preventing them from being lost during hook execution.

    2.1.7release notes

  • Skips PTY allocation when stdout is not a terminal.

    2.1.6release notes

  • Ensures root includes a trailing slash before path replacement.

    2.1.6release notes

  • Logs the full scoped name for skipped jobs.

    2.1.6release notes

  • Packaging no longer pipes stdout and stderr.

    2.1.6release notes

  • Normalizes the lefthook path used for the sh script on Windows.

    2.1.6release notes

  • Fixes an issue involving Git repository merges.

    2.1.5release notes

  • Prevents lefthook run from overwriting global hooks.

    2.1.5release notes

  • Uses pre-push stdin for push file detection.

    2.1.5release notes

  • Separates non-option arguments with -- in more commands.

    2.1.4release notes

  • Restores the {lefthook_job_name} template.

    2.1.4release notes

  • Support for Git debug versions was fixed.

    2.1.3release notes

  • Auto-staged changes are rolled back if unwanted changes are detected.

    2.1.2release notes

  • Colors are reset when reading configuration.

    2.1.1release notes

  • The JSON schema now accepts a string for file_types.

    2.0.16release notes

  • A direct file is read instead of reading all remotes.

    2.0.16release notes

  • Execution is skipped if an any-files template is empty.

    2.0.14release notes

  • The JSON schema now allows custom hooks, so configurations using them can be validated against the schema.

    2.0.13release notes

  • The extends value is set to an empty slice after loading remotes.

    2.0.13release notes

  • Makes the Git short status parser more robust.

    2.0.12release notes

  • Skips the template when the files are empty.

    2.0.10release notes

  • Improves separation of options and filenames for more git commands.

    2.0.9release notes

  • The pre-commit hook is skipped when there are no staged files.

    2.0.9release notes

  • Scanner errors are now checked and reported.

    2.0.9release notes

  • Fixes the JSON Schema values for glob_matcher.

    2.0.4release notes

  • Adds a mutex lock before all git commands.

    2.0.2release notes

  • The CLI accepts --fail-on-changes=false as an override value.

    2.0.0release notes