Skip to content

support prepare-commit-msg Git hook #4995

@rznn7

Description

@rznn7

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 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions