Sypha AI Docs
FeaturesCommands and shortcuts

Generate Commit Message

Sypha's Git integration incorporates AI assistance directly into your version control workflow. Generate commit messages without departing from your editor.

Generate Commit Message

Among the most valuable Git integrations is the capability to automatically generate meaningful commit messages:

Generate Commit Message with Sypha
  1. Make your modifications and stage them in Git
  2. Click the robot icon in the Source Control view or execute the "Generate Commit Message with Sypha" command
  3. Sypha analyzes your modifications and generates a descriptive commit message
  4. The message is automatically inserted into the commit message input box

The generated commit messages:

  • Begin with a concise summary (50-72 characters)
  • Use imperative mood (e.g., "Add feature" not "Added feature")
  • Describe what was modified and why
  • Follow Git best practices

This capability saves time and ensures your commit history remains consistent and informative.

For information about using @git-changes and @[commit-hash] mentions in your chat messages, see the Git Mentions documentation.

How It Works

When you utilize Sypha's commit message generation feature, here's what occurs behind the scenes:

  1. Sypha retrieves the current Git diff using getWorkingState()
  2. It formats this diff into a specialized prompt for the AI
  3. The AI analyzes the modifications and generates an appropriate commit message
  4. The message is extracted and inserted into the Git commit message input box

This process utilizes your current Sypha API configuration, so the quality of the generated messages corresponds to your chosen AI model.

Tips for Effective Use

  • Generate commit messages for complex changes: The AI excels at summarizing multiple related modifications 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 necessary.

  • Stage related changes together: For optimal results, stage related modifications together so the AI can generate a cohesive message.

  • Use for consistent commit history: Utilizing 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:

  1. When you trigger the command:
    • Sypha obtains 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

This integration with Git facilitates generating high-quality commit messages without disrupting your workflow.

Next time you're struggling to compose a good commit message, try utilizing Sypha's commit message generation. You'll save time and improve your version control workflow with AI assistance right where you need it.

On this page