GitWise Quick Reference
🚀 Setup
pip install pygitwise # Basic installation
pip install "pygitwise[offline]" # With offline model support
gitwise init # Configure AI backend
🤖 AI Backend Selection
# Environment variables
export GITWISE_LLM_BACKEND=ollama # Default (recommended)
export GITWISE_LLM_BACKEND=offline # Built-in model
export GITWISE_LLM_BACKEND=online # OpenRouter API
# Quick switch
gitwise init # Interactive reconfiguration
📝 Core Commands
Stage & Commit
gitwise add . # Interactive staging
gitwise add file1.py file2.py # Stage specific files
gitwise commit # AI-generated commit message
gitwise commit --group # Split into multiple commits
Context Management
gitwise set-context "description" # Set context for better AI suggestions
gitwise get-context # View current branch context
Push & PR
gitwise push # Push with PR prompt
gitwise pr # Create PR with AI description
gitwise pr --labels # Add suggested labels
gitwise pr --checklist # Add context-aware checklist
gitwise pr --draft # Create draft PR
Changelog
gitwise changelog # Generate changelog for release
gitwise changelog --auto-update # Update unreleased section
gitwise setup-hooks # Install pre-commit hook
Git Passthrough
gitwise status # git status
gitwise log --oneline -5 # git log
gitwise diff # git diff
gitwise <any-git-command> # Direct passthrough
⚙️ Configuration
Ollama
export OLLAMA_MODEL=llama3 # Change model
export OLLAMA_URL=http://localhost:11434 # Custom server
ollama pull codellama # Download new model
Offline
export GITWISE_OFFLINE_MODEL="TinyLlama/TinyLlama-1.1B-Chat-v1.0"
Online
export OPENROUTER_API_KEY="your_key"
export OPENROUTER_MODEL="anthropic/claude-3-haiku"
🔥 Pro Tips
- Group commits for refactoring:
gitwise commit --group
- Quick PR with everything:
gitwise pr --labels --checklist
- Check Ollama status:
curl http://localhost:11434/api/tags
- Force offline mode:
export GITWISE_LLM_BACKEND=offline
- Custom config path:
export GITWISE_CONFIG_PATH=~/.myconfig.json
🆘 Troubleshooting
# Ollama not working?
ollama serve # Start Ollama service
ollama list # Check available models
# Permission issues?
chmod +x ~/.git/hooks/pre-commit # Fix hook permissions
# Config issues?
rm ~/.gitwise/config.json # Reset configuration
gitwise init # Reconfigure