Beginner
How to generate AI commit messages on Cursor
Quick Answer
Cursor's AI can automatically generate commit messages by analyzing your staged changes. Simply stage your files, open the Git panel, and use the AI commit message feature to create descriptive, contextual commit messages instantly.
Prerequisites
- Cursor IDE installed
- Git repository initialized
- Staged changes in your project
1
Stage your changes
Open the Source Control panel by clicking the Git icon in the left sidebar or pressing
Ctrl+Shift+G (Windows/Linux) or Cmd+Shift+G (Mac). Review your modified files and click the + button next to each file you want to stage, or click Stage All Changes to stage everything.Tip
Only stage related changes together to get more focused commit messages
2
Access the commit message box
In the Source Control panel, locate the commit message input field at the top. This is where you'll normally type your commit message manually. Make sure you have at least one staged change before proceeding to the next step.
3
Generate AI commit message
Look for the sparkle icon (✨) or AI button next to the commit message input field. Click this button to trigger Cursor's AI to analyze your staged changes and generate an appropriate commit message automatically.
Tip
The AI analyzes file changes, additions, and deletions to create contextual messages
4
Review the generated message
Cursor's AI will populate the commit message field with a descriptive message based on your changes. Review the generated text to ensure it accurately describes what you've modified. The message should follow conventional commit format with a clear, concise description.
Tip
You can regenerate the message by clicking the AI button again if you're not satisfied
5
Edit if necessary
If the AI-generated message needs adjustments, click in the commit message field and edit the text directly. You can add more context, fix any inaccuracies, or adjust the tone to match your project's commit style guidelines.
Tip
Consider adding ticket numbers or breaking change notes that the AI might miss
6
Commit your changes
Once you're satisfied with the commit message, click the Commit button or press
Ctrl+Enter (Windows/Linux) or Cmd+Enter (Mac) to create the commit with your AI-generated message.Troubleshooting
AI commit button not visible
Ensure you have staged changes and are using the latest version of Cursor. The AI features may require an active internet connection and Cursor Pro subscription.
Generated commit message is too generic
Try staging fewer, more related files together. Make sure your changes are meaningful and not just whitespace or formatting adjustments.
AI generation fails or times out
Check your internet connection and try again. If the issue persists, restart Cursor or manually write the commit message as a fallback.
Commit message doesn't follow project conventions
Edit the generated message to match your team's style guide. You can also configure Cursor's AI settings to better align with your project's commit message format preferences.
Ready to get started with Cursor?
Put this tutorial into practice. Visit Cursor and follow the steps above.
Visit Cursor →