GitAICLI
Smart CLI for AI-driven Git commit & PR generation.
AI Git Commit Message
Generate commit messages automatically based on code changes and Conventional Commits
Pull Request Docs Generation
Generate pull request docs according to your predefined template
Multi Model Support
Support multiple models, including GPT, GROK, Gemini and Ollama (Private and secure)
How GitAI Works
GitAI leverages the power of AI to analyze your code changes and generate meaningful commit messages and PR descriptions.
1. Analyzes Your Changes
GitAI CLI reads your current git diff, file tree, and branch information directly from your repository.
2. Leverages AI Models
Your changes are processed by advanced language models like GPT-4, Gemini, or local models via Ollama.
3. Generates Quality Output
Get standardized commit messages following Conventional Commits specification or comprehensive PR descriptions.
Quick Start
Get up and running with GitAI CLI in minutes
NPM Installation
Quick install via npm (requires Node.js 20+)
Install globally
Initialize in your project
Set up environment
Build from Source
Build and install from the latest source code
Clone repository
Install dependencies
Build and link locally
Usage Examples
Commit Generation
Generate 3 commit message suggestions
PR Description
Generate PR description against master branch
Advanced Usage
Generate commit with custom context
Configuration
GitAI CLI is highly customizable to fit your workflow
Flexible Configuration
Customize providers, models, and settings per command
Multiple Providers
Support for OpenAI, DeepSeek, Gemini, Grok, and Ollama
Secure by Default
Environment-based secrets management
Command-specific Settings
Fine-tune behavior for commits and PRs separately
llm:
default:
provider: openai
model: gpt-4o-mini
apiKeyEnvVar: 'OPENAI_API_KEY'
baseUrlEnvVar: 'OPENAI_BASE_URL'
temperature: 0.7
commands:
commit:
# provider: deepseek # Example: override for commit command
# model: deepseek-chat
# apiKeyEnvVar: 'DEEPSEEK_API_KEY'
pr:
# provider: ollama # Can be changed to 'grok' or 'gemini' ...
# model: deepseek-r1:32b
# temperature: 0.4
commit:
suggestions: 3
prompt_template: './prompts/commit_prompt.txt'
pr:
base_branch: main # When user doesn't pass --target
include_file_tree: true # Whether to include the file tree generated by ls-files
include_unstaged: false # Corresponds to --unstaged
max_lines_per_file: 300 # Diff truncation threshold
warn_on_conflict: true # Whether to interrupt when merge conflicts are detected
prompt_template: ./prompts/pr_prompt.txt
Command Showcase
Explore the powerful commands GitAI CLI offers
Generate Commit Messages
Generate meaningful commit messages that follow the Conventional Commits specification
# Generate commit messages for staged changes
gitai commit
# Provide additional context to the AI
gitai commit -p "Focus on refactoring of user service"
# Get 5 suggestions
gitai commit -n 5
# (macOS example) Copy prompt to clipboard for use with web-based AI
gitai commit --print-prompt | pbcopy
- Generate multiple suggestions at once
- Follows Conventional Commits format
- Add custom context with the -p flag
- Customize the number of suggestions with -n
Future Roadmap
Exciting features planned for upcoming GitAI CLI releases
gitai query
Query your Git repository using natural language. Get information about branches, recent commits, and status with the power of AI.
- All local and remote branches
- Current branch name
- Recent Git log (last 10 commits)
- Current git status
gitai context
Export project information as AI-friendly context in Markdown or JSON format for external AI models or debugging.
- Current git diff (staged, working directory or between specified commits)
- Project file structure (filterable by depth, size, extension)
- package.json dependencies, current branch name, recent commit history
Demo Preview
Input:
What changes were made in the last week?
Output:
Analyzing recent commits (last 7 days): 1. feat(auth): Add OAuth2 provider integration - Added OAuth2 client configuration - Implemented token refresh logic - Added user profile sync 2. fix(api): Handle rate limiting edge cases - Added retry mechanism - Improved error messages 3. docs: Update API authentication guide - Added OAuth2 setup instructions - Updated example requests