jesseduffield / jesseduffield/lazygit

support `prepare-commit-msg` Git hook

Open
#4,995 3 comments 14 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

### Is your feature request related to a problem? Please describe.

The `prepare-commit-msg` Git hook is currently being ignored when committing through lazygit, both in the commit popup and editor mode. This prevents automatic commit message preparation workflows from functioning as expected.

### Describe the solution you'd like

I'd like lazygit to execute the `prepare-commit-msg` hook before presenting the commit message input interface (both in the commit popup and editor mode). This would align lazygit's behavior with standard Git workflow, where the hook runs before the user enters their commit message, allowing the hook to pre-populate or modify the message template.

### Describe alternatives you've considered

A custom command might work as a workaround? but this feels like it should be the default behavior to maintain consistency with Git's standard hook execution flow.

### Additional context

My specific use case involves a `prepare-commit-msg` hook that automatically prepends ticket numbers to commit messages based on the current branch name (e.g., extracting `PROJ-123` from a branch like `feature/PROJ-123-add-new-feature`).

I'd be happy to submit a PR to implement this feature if needed 🙂

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.