wit ai command provides AI-powered features for your development workflow, including natural language commands, automatic commit message generation, code review, and conflict resolution assistance.
Overview
Commands
chat / ask
Interact with the AI assistant using natural language.Examples
commit
Generate an AI-powered commit message and optionally create the commit.Options
| Option | Description |
|---|---|
-a, --all | Stage all tracked files before committing |
--dry-run | Preview the commit message without creating the commit |
Examples
Commit Message Format
The AI generates conventional commit messages following best practices:feat:- New featurefix:- Bug fixrefactor:- Code refactoringdocs:- Documentation changestest:- Adding/updating testschore:- Maintenance tasksperf:- Performance improvementsstyle:- Formatting, whitespace
review
Get an AI-powered code review of your changes.Options
| Option | Description |
|---|---|
--staged | Review only staged changes |
Examples
What the AI Reviews
The AI analyzes your code changes for:- Potential bugs or issues - Logic errors, edge cases
- Security concerns - Injection vulnerabilities, exposed secrets
- Code quality - Readability, maintainability
- Best practices - Design patterns, conventions
Example Output
explain
Get an AI explanation of a commit or range of commits.Arguments
| Argument | Description |
|---|---|
ref | Commit reference to explain (default: HEAD) |
Examples
Example Output
resolve
Get AI assistance for resolving merge conflicts.Arguments
| Argument | Description |
|---|---|
file | Specific file to resolve (optional, resolves all if omitted) |
Examples
Example Output
status
Check the AI configuration and availability.Example Output
Configuration
API Keys
The AI features require an API key from a supported provider:Model Selection
Override the default model:Workflow Examples
Feature Development with AI
Handling Merge Conflicts
Quick Status Check
Best Practices
Review AI suggestions
Review AI suggestions
Always review AI-generated content before committing or merging. The AI provides suggestions, not absolute answers.
Provide context
Provide context
More specific questions get better answers:
Use dry-run for commits
Use dry-run for commits
Preview commit messages with
--dry-run before creating actual commits:Stage selectively
Stage selectively
Stage only related changes before using
wit ai commit for more focused commit messages.Troubleshooting
AI features require an API key
AI features require an API key
If you see this error, set one of the supported API keys:
Model errors
Model errors
If you encounter model-specific errors, try a different model:
Context limits
Context limits
For very large diffs, the AI may truncate or summarize. Consider:
- Staging fewer files at once
- Breaking large changes into smaller commits
Related Commands
wit agent- Interactive AI coding assistantwit search- AI-powered semantic searchwit review- AI code review for PRswit commit- Standard commit command