commit command generates intelligent git commit messages based on your staged changes using AI.
Quick Start
Usage
Basic Commit
Commit and Push
Workflow
- Stage Changes: Use
git addto stage your changes - Run Command: Execute
praisonai commit - Review Message: AI generates a commit message based on the diff
- Choose Action:
y- Accept and commite- Edit the message in your default editorn- Cancel
Commit Message Format
The AI follows the Conventional Commits specification:Types
| Type | Description |
|---|---|
feat | A new feature |
fix | A bug fix |
docs | Documentation changes |
style | Code style changes (formatting, etc.) |
refactor | Code refactoring |
test | Adding or updating tests |
chore | Maintenance tasks |
Examples
Options
| Option | Description |
|---|---|
--push | Automatically push after committing |
Requirements
- Git must be installed and available in PATH
- You must be in a git repository
- Changes must be staged with
git add
Error Handling
No Staged Changes
git add . or git add <file>
Not in Git Repository
git init
Customization
Using a Different Model
Custom Editor
Set theEDITOR environment variable to use your preferred editor:
Best Practices
Review Before Accepting
Always review the generated message before accepting
Stage Related Changes
Stage related changes together for better commit messages
Small Commits
Make small, focused commits for clearer messages
Edit When Needed
Use the edit option to refine the message
Integration with Git Workflow
Troubleshooting
| Issue | Solution |
|---|---|
| Empty commit message | Ensure changes are staged and diff is not empty |
| API error | Check your OpenAI API key is set |
| Editor not opening | Set the EDITOR environment variable |
| Push failed | Check remote repository access and authentication |
Related
- CLI Overview - PraisonAI CLI documentation
- Planning - AI planning mode

