GitPilot is an intelligent AI-powered Git assistant that bridges the gap between natural language and Git commands. It's designed to make Git more accessible and efficient by allowing developers to express their intentions in plain English, while providing context-aware suggestions and safety checks.
- Natural Language Processing: Converts plain English requests into precise Git commands
- Context-Aware Intelligence: Analyzes your repository state to provide relevant suggestions
- Multi-Model Support: Choose from multiple AI providers and models:
- Google Gemini: Gemini 2.0 Flash for fast, accurate responses
- Groq: Lightning-fast inference with Llama 3.1 8B Instant, Llama 3.3 70B Versatile
- DeepSeek: Advanced reasoning with R1 Distill Llama 70B
- Intelligent Response Parsing: Enhanced parsing handles various response formats from different AI models
- Destructive Operation Detection: Identifies potentially dangerous commands and requires confirmation
- Command Validation: Prevents command injection and validates Git syntax
- Dry-Run Mode: Preview commands before execution
- Context Warnings: Alerts about uncommitted changes, remote status, and other potential issues
- Branch Status: Current branch, detached HEAD detection
- Working Directory State: Staged, unstaged, and untracked files
- Remote Synchronization: Ahead/behind status with remote repositories
- Stash Management: Stash count and status
- Commit History: Last commit information and analysis
- Rich Terminal Interface: Beautiful, colorized output with progress indicators
- Command History: Track and review previously executed commands
- Detailed Explanations: Optional explanations for generated commands
- Interactive Prompts: Confirmation dialogs for destructive operations
GitPilot is built with a modular architecture:
βββ cli.py # Command-line interface and user interaction
βββ ai_engine.py # Multi-model AI integration (Gemini, Groq, DeepSeek)
βββ context_analyzer.py # Git repository state analysis
βββ git_executor.py # Safe Git command execution
βββ logger.py # Logging and command history
βββ prompts.py # AI prompt templates
- CLI Interface: Rich terminal interface with colorized output and interactive prompts
- AI Engine: Multi-provider AI integration supporting:
- Google Gemini (gemini-2.0-flash)
- Groq (llama-3.1-8b-instant, llama-3.3-70b-versatile)
- DeepSeek (deepseek-r1-distill-llama-70b)
- Context Analyzer: Analyzes Git repository state and provides contextual information
- Git Executor: Safely executes Git commands with validation and safety checks
- Logger: Tracks command history and provides debugging information
- Python 3.8 or higher
- Git installed and configured
- At least one AI provider API key:
- Google Gemini API key (set as
GEMINI_API_KEY
environment variable) - Groq API key (set as
GROQ_API_KEY
environment variable) - for Groq models - Both keys can be used simultaneously for maximum flexibility
- Google Gemini API key (set as
pip install gitpilot
git clone https://github.com/InflixOp/gitpilot.git
cd gitpilot
pip install -e .
git clone https://github.com/InflixOp/gitpilot.git
cd gitpilot
pip install -e .[dev]
GitPilot is also available as a VS Code extension! Get the same AI-powered Git assistance directly integrated into your favorite editor.
- Open VS Code
- Go to the Extensions view (
Ctrl+Shift+X
) - Search for "GitPilot"
- Click "Install" on the GitPilot - AI Git Assistant extension
code --install-extension InflixOP.gitpilot
- π€ AI-Powered Panel: Beautiful integrated sidebar panel
- π Command Palette Integration: Access via
Ctrl+Shift+P
- π― Context Menu: Right-click integration in Explorer
- βοΈ Settings Integration: Configure API keys in VS Code settings
- π Real-time Repository Status: Live Git status display
- π¨ VS Code Theming: Matches your VS Code theme perfectly
- Install the extension (see methods above)
- Configure API keys:
- Go to VS Code Settings (
Ctrl+,
) - Search for "GitPilot"
- Add your Gemini or Groq API key
- Go to VS Code Settings (
- Start using:
- Click the robot icon π€ in the Activity Bar
- Or use
Ctrl+Shift+P
β "GitPilot: Execute Command"
"create a new branch for user authentication"
β git checkout -b feature/user-authentication
"commit all changes with message 'Add login functionality'"
β git add . && git commit -m "Add login functionality"
"show commits from last week"
β git log --since="1 week ago" --oneline
-
Set up your API keys:
# For Google Gemini (default) export GEMINI_API_KEY="your-gemini-api-key" # For Groq models (optional) export GROQ_API_KEY="your-groq-api-key"
-
Navigate to a Git repository:
cd your-git-project
-
Start using GitPilot:
# Use default model (Gemini) gitpilot "create a new branch for user authentication" # Or select a specific model gitpilot --model 2 "show me the current status" # Groq Llama 3.1 8B gitpilot --model 3 "commit all changes" # Groq Llama 3.3 70B
# Create and switch to a new branch
gitpilot "create a new branch called feature-auth"
# Switch to an existing branch
gitpilot "switch to main branch"
# Delete a branch
gitpilot "delete the old-feature branch"
# Stage and commit changes
gitpilot "commit all changes with message 'Add user authentication'"
# Undo last commit but keep changes
gitpilot "undo last commit but keep the changes"
# Amend the last commit
gitpilot "modify the last commit message"
# Push to remote repository
gitpilot "push changes to origin"
# Pull latest changes
gitpilot "pull latest changes from remote"
# Sync with remote branch
gitpilot "sync with remote main branch"
# Check repository status
gitpilot "show me the current status"
# View commit history
gitpilot "show commits from last week"
# Check differences
gitpilot "show what changed in the last commit"
gitpilot [OPTIONS] [QUERY]
--dry-run, -d
: Show what would be executed without running the command--explain, -e
: Show detailed explanation of the generated command--yes, -y
: Auto-confirm destructive operations--history, -h
: Show recent command history--version
: Show version information--model, -m
: Select AI model (1: Gemini, 2: Llama 3.1 8B, 3: Llama 3.3 70B, 4: DeepSeek R1)--skip-model-selection
: Skip interactive model selection and use default
# Preview command without execution
gitpilot "reset to last commit" --dry-run
# Get explanation of the command
gitpilot "merge feature branch" --explain
# Auto-confirm destructive operation
gitpilot "force push to remote" --yes
# View command history
gitpilot --history
# Use specific AI models
gitpilot --model 2 "show me recent commits" # Groq Llama 3.1 8B
gitpilot --model 3 "create a hotfix branch" # Groq Llama 3.3 70B
gitpilot --model 4 "help me resolve merge conflicts" # DeepSeek R1
# Skip model selection for automation
gitpilot --skip-model-selection "add all files"
Create a configuration file at ~/.gitpilot/config.yaml
:
# Auto-confirm destructive operations
auto_confirm: false
# Always show detailed explanations
explain_by_default: false
# Logging level (INFO, DEBUG, ERROR)
log_level: INFO
GEMINI_API_KEY
: Your Google Gemini API key (required for Gemini models)GROQ_API_KEY
: Your Groq API key (required for Groq models)GITPILOT_LOG_LEVEL
: Override log level (optional)
GitPilot automatically detects potentially destructive operations:
git reset --hard
: Discards uncommitted changesgit clean -f
: Permanently deletes untracked filesgit push --force
: Overwrites remote historygit rebase
: Rewrites commit history
- Uncommitted Changes: Warns before operations that might lose work
- Remote Status: Alerts when branch is behind remote
- Detached HEAD: Notifies about detached HEAD state
- Stash Status: Considers stashed changes in recommendations
click>=8.0.0
: Command-line interface frameworkrich>=13.0.0
: Rich terminal formattinggoogle-generativeai>=0.3.0
: Google Gemini AI integrationgitpython>=3.1.0
: Git repository interactionpyyaml>=6.0.0
: Configuration file parsingloguru>=0.7.0
: Advanced logging
pytest>=7.0.0
: Testing frameworkpytest-cov>=4.0.0
: Coverage reportingblack>=23.0.0
: Code formattingflake8>=6.0.0
: Code lintingmypy>=1.0.0
: Type checking
# Run all tests
pytest
# Run with coverage
pytest --cov=gitpilot
# Run specific test file
pytest tests/test_cli.py
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a virtual environment:
python -m venv venv
- Activate it:
source venv/bin/activate
(Linux/Mac) orvenv\Scripts\activate
(Windows) - Install dependencies:
pip install -e .[dev]
- Run commands starting with "gitpilot"
Found a bug? Please report it on our GitHub Issues page.
This project is licensed under the MIT License - see the LICENSE file for details.