Generate Commit Message
One of the most useful Git integrations is the ability to automatically generate meaningful commit messages:
- Make your changes and stage them in Git
- Click the robot icon in the Source Control view or run the “Generate Commit Message with Sixth” command
- Sixth analyzes your changes and generates a descriptive commit message
- The message is automatically inserted into the commit message input box
- Start with a concise summary (50-72 characters)
- Use imperative mood (e.g., “Add feature” not “Added feature”)
- Describe what was changed and why
- Follow Git best practices
For information about using
@git-changes
and @[commit-hash]
mentions in your chat messages, see the Git
Mentions documentation.How It Works
When you use Sixth’s commit message generation feature, here’s what happens behind the scenes:- Sixth retrieves the current Git diff using
getWorkingState()
- It formats this diff into a specialized prompt for the AI
- The AI analyzes the changes and generates an appropriate commit message
- The message is extracted and inserted into the Git commit message input box
Tips for Effective Use
- Generate commit messages for complex changes: The AI excels at summarizing multiple related changes into a coherent message.
- Review and edit generated messages: While the AI generates high-quality messages, it’s always good practice to review and adjust them if needed.
- Stage related changes together: For the best results, stage related changes together so the AI can generate a cohesive message.
- Use for consistent commit history: Using the generate commit message feature helps maintain a consistent style across your commit history.
How It Works Under the Hood
The commit message generation leverages VSCode’s Git extension API to access repository information:- When you trigger the command:
- Sixth gets the current diff
- It sends this to the AI with specific instructions for commit message formatting
- It parses the AI’s response
- It accesses the Git extension API to set the commit message