commit command is GitWhisper’s primary feature. It analyzes your staged changes and generates intelligent, contextual commit messages using AI.
Basic Usage
- Check for staged changes in your repository
- Analyze the diff using the default AI model (or prompt you to select one)
- Generate a commit message
- Create the commit
Command Options
AI model to use for generating commit messages.Allowed values:
claude- Anthropic Claudeopenai- OpenAI GPT modelsgemini- Google Geminigrok- xAI Grokllama- Meta Llamadeepseek- DeepSeek, Inc.github- GitHub Modelsollama- Ollama (local models)free- Free tier via LLM7.io (no API key required)
-mAPI key for the selected model. If not provided, GitWhisper will check:
- Saved configuration (via
gw save-key) - Environment variables
ollama and free models.Shorthand: -kSpecific variant of the AI model to use.Examples:
gpt-4o(OpenAI)claude-sonnet-4-20250514(Claude)gemini-2.0-flash(Gemini)
-vAdd a prefix to the commit message, useful for ticket numbers or issue references.Example:
JIRA-123, GH-456Shorthand: -pAutomatically push the commit to the remote repository after creating it.Shorthand:
-aPrompt for confirmation before applying the commit message. When enabled, you can:
- commit - Accept the generated message
- edit - Open in your git editor to modify
- retry - Regenerate with the same or different model
- discard - Cancel the commit
-cNote: Can be set as default via gw set-defaults --confirm-commitsCreate a git tag for this commit.Example:
v1.0.0, release-2024-03Shorthand: -tUsage Examples
Terminal Output Example
Workflow Scenarios
No Staged Changes
If you haven’t staged any changes, GitWhisper will:- Detect unstaged or untracked files
- Prompt you to stage them automatically
- Proceed with commit generation
always-add is enabled, this happens automatically without prompting.
Large Diffs
For very large changesets, GitWhisper automatically:- Processes files individually
- Generates summaries for each file
- Combines summaries into a cohesive commit message
gw set-defaults --max-diff-size).
Large Files
GitWhisper warns about large files (>10MB by default) and offers options to:- Proceed anyway
- Add to
.gitignoreand unstage - Cancel the commit
Multi-Repository Support
If run from a parent directory containing multiple git repositories, GitWhisper will:- Detect all subdirectories with staged changes
- Generate individual commits for each repository
- Report success/failure for each
Environment Variables
API keys can be provided via environment variables:Related Commands
- analyze - Analyze changes without committing
- set-defaults - Configure default model and options
- always-add - Auto-stage changes