AI Commit Feature
Feature Introduction 🤖
iGit’s AI commit feature uses advanced AI models to analyze your code changes and automatically generate commit messages that comply with the Conventional Commits specification. This not only saves your time but also ensures the quality and consistency of commit messages.
How It Works ⚙️
-
Collect Changes
When you run
igit commit
, iGit collects all changes in the Git staged area. -
Analyze Changes
The AI model analyzes these changes, including:
- Modified file types
- Code additions, deletions, and modifications
- Change context
-
Generate Commit Message
Based on the analysis, AI generates a commit message following the conventional commits specification, including:
- Type (
feat
/fix
/docs
etc.) - Scope (optional)
- Description
- Detailed explanation (if needed)
- Type (
-
Confirm Commit
You can choose to accept or modify the generated commit message.
Usage 📝
Basic Usage
# Generate commit message and wait for confirmationigit commit
# Generate commit message and commit directlyigit commit -y
# Generate message only without git commitigit commit -d# origit commit --dry-run
Commit Types
AI will automatically select the most appropriate commit type based on the changes:
feat
: New featurefix
: Bug fixdocs
: Documentation updatesstyle
: Code style changesrefactor
: Code refactoringperf
: Performance improvementstest
: Test-related changeschore
: Build process or auxiliary tool changes
Best Practices 💡
1. Keep Changes Focused
Include only related changes in each commit, so AI can better understand your intentions.
2. Use Staged Area
Make sure all files you want to commit are added to the staged area:
git add <files>igit commit
3. Review Generated Messages
Although AI usually generates high-quality commit messages, it’s best to quickly review them to ensure they accurately reflect your intentions.
Common Questions ❓
Q: Why are generated commit messages sometimes not accurate enough?
A: This might be due to:
- Changes being too complex or scattered
- Staged area containing unrelated changes
- AI model unable to fully understand specific business context
Q: How to improve the quality of generated commit messages?
- Ensure each commit contains only related changes