Skip to content

Feature Request: Auto-generate commit summary with AI integration (e.g., Cursor/opencode) #5461

@pengatgstdev

Description

@pengatgstdev

Description

Currently, when committing changes in Lazygit, users have to manually write commit messages. It would be great if Lazygit could integrate with AI services (like Cursor, opencode, or local LLMs) to auto-generate commit summaries based on the staged changes.

like Cursor:

Image

Use Case

When commit code in Lazygit, a user could:

  1. Stage files as usual
  2. Press a key (e.g., Ctrl+G or a dedicated button) to generate a commit message
  3. Lazygit sends the staged diff to an AI service (or local model) and returns a suggested summary
  4. User can review, edit, and accept the message

This would save significant time, especially for:

  • Developers who make frequent commits
  • Teams requiring standardized commit message formats
  • Users who struggle to write concise, descriptive commit messages

Suggested Implementation

Option A: External CLI Integration
Allow Lazygit to call an external command/script that:

  • Receives the staged diff (or file list) as input
  • Returns a commit message
  • Example: lazygit-commit-helper could be user-configurable to call git diff --staged | ai-summarize

Option B: Built-in AI Integration
Add optional configuration to Lazygit's config.yml:

ai:
  provider: "openai" # or "anthropic", "local"
  api_key: "your-key"
  model: "gpt-4o-mini"
  prompt_template: "Generate a concise commit message for these changes:"

Option C: Simple LLM-friendly Output Mode
Add a flag/mode where Lazygit outputs the staged diff to stdout so it can be piped to an AI tool:

lazygit --print-staged-diff | ai-summarize

Why This Matters

  • Productivity: Reduces context switching between terminal and Lazygit
  • Consistency: Helps enforce conventional commit formats
  • Accessibility: Helps users who struggle with writing commit messages

Related

This is similar to features in other Git tools:

  • GitLens (VS Code) has "AI Generate Commit Message"
  • GitKraken has "AI Commit Message" (paid feature)
  • Many CLI tools now offer AI-powered commit helpers

Potential Challenges

  • API key management (should be user's responsibility)
  • Network latency (could be optional/off by default)
  • Cost concerns (should be opt-in)

Would the maintainers be open to this feature? Happy to help discuss implementation details or submit a PR if there's interest.

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