AI-powered git commit tool that analyzes your changes, groups them logically, and creates meaningful commits following the Conventional Commits standard.
- Multi-Provider Support - Choose between OpenAI (GPT-4o-mini), Google Gemini (Gemini 3 Flash Preview), or z.ai (GLM-4.7)
- Smart Commit Grouping - AI analyzes your changes and groups related files together by feature or purpose
- Conventional Commits - Automatically generates commit messages in standard format (
feat,fix,refactor,chore, etc.) - Web UI - Full web interface for selecting files, viewing diffs, and creating commits visually
- Stash Viewer - Browse and manage git stashes in a beautiful web UI with diff viewer
- Safe Workflow - Always shows a commit plan for your approval before making any changes
- Gitignore Support - Automatically skips files in .gitignore
npm install -g @mehmetsagir/git-aiBefore using git-ai, you need to configure your AI provider and API key:
git-ai setupYou'll be prompted to:
-
Select an AI provider:
- OpenAI (GPT-4o-mini) - Most popular, reliable performance
- Google Gemini (Gemini 3 Flash Preview) - Fast, cutting-edge Google AI
- z.ai (GLM-4.7) - Cost-effective alternative with GLM models
-
Enter your API key for the selected provider
- OpenAI: Get your key from OpenAI Platform
- Gemini: Get your key from Google AI Studio
- z.ai: Get your key from z.ai
Analyze all changes in your repository and create intelligent commits.
git-ai commitWhat it does:
- Scans all changes (staged, unstaged, and untracked files)
- Sends diff to AI for analysis
- Groups related files together
- Generates commit messages for each group
- Shows you the commit plan for approval
- Creates commits after your confirmation
Example output:
π€ Git AI
β Found 5 file(s), 8 change(s)
Changes:
+ src/new-feature.ts
~ src/auth.ts
~ src/config.ts
- src/old-file.ts
β Created 3 commit group(s)
π Commit Plan:
1. Add authentication feature
src/auth.ts
src/new-feature.ts
β feat(auth): add login functionality
2. Update configuration
src/config.ts
β refactor(config): simplify config handling
3. Remove deprecated code
src/old-file.ts
β chore: remove unused files
? Proceed with commits? Yes
β 3 commit(s) created
β Don't forget to push: git push
Open a web-based UI to browse and manage your git stashes.
git-ai stashFeatures:
- View all stashes in a clean list
- Click to see changed files and full diff
- VS Code-style split diff view (Original | Modified)
- Apply stash to your working directory
- Delete stashes you no longer need
- Syntax highlighting for code changes
Open a full web UI for managing commits with real-time file changes.
git-ai uiFeatures:
- Real-time view of all changed files
- Select files with checkboxes
- View diff for each file
- AI analyzes selected files and creates smart commit groups
- Multiple commits from a single selection (chunks related changes)
- Review commit plan before executing
- Create commits with one click
How it works:
- Select the files you want to commit
- Click "Analyze with AI" - AI groups related changes
- Review the proposed commit plan (may include multiple commits)
- Click "Create Commits" to execute
Configure or update your AI provider and API key.
git-ai setupYou can run this command anytime to:
- Switch between AI providers
- Update your API key
- Reconfigure your settings
Reset all configuration (removes stored API key).
git-ai resetgit-ai supports multiple AI providers, giving you flexibility in choosing the best option for your needs:
- Best for: Reliable, consistent performance
- Model: gpt-4o-mini
- Speed: Fast
- Cost: Moderate
- Get API Key: OpenAI Platform
- Best for: Cutting-edge performance, fast responses
- Model: gemini-3-flash-preview
- Speed: Very Fast
- Cost: Competitive
- Get API Key: Google AI Studio
- Best for: Cost-effective alternative
- Model: GLM-4.7
- Speed: Fast
- Cost: Low
- Get API Key: z.ai
- Note: Uses OpenAI-compatible API format
All providers produce identical commit structures and follow the same quality standards.
Configuration is stored in ~/.git-ai/config.json:
{
"provider": "openai",
"openaiKey": "sk-...",
"geminiKey": "AI...",
"zaiKey": "..."
}The tool will use the provider specified in the config and its corresponding API key.
- Node.js >= 14.0.0
- Git repository
- API key from one of the supported providers:
- OpenAI (https://platform.openai.com/api-keys)
- Google Gemini (https://makersuite.google.com/app/apikey)
- z.ai (https://z.ai/)
Contributions are welcome! Here's how you can help:
-
Clone the repository
git clone https://github.com/mehmetsagir/git-ai.git cd git-ai -
Install dependencies
npm install
-
Build the project
npm run build
-
Test locally
# Run directly node bin/git-ai [command] # Or link globally npm link git-ai [command]
src/
βββ index.ts # CLI entry point and command routing
βββ git.ts # Git operations (using simple-git)
βββ openai.ts # [Deprecated] Legacy OpenAI module
βββ commit.ts # Commit workflow logic
βββ stash.ts # Stash viewer web UI
βββ ui.ts # Commit manager web UI
βββ config.ts # Configuration management
βββ setup.ts # Setup wizard with provider selection
βββ reset.ts # Reset configuration
βββ prompts.ts # AI prompts for commit analysis
βββ types.ts # TypeScript type definitions
βββ providers/ # AI provider abstraction
β βββ types.ts # IAIProvider interface
β βββ index.ts # Provider factory
β βββ openai.ts # OpenAI provider (GPT-4o-mini)
β βββ gemini.ts # Google Gemini provider (Gemini 3 Flash)
β βββ zai.ts # z.ai provider (GLM-4.7)
βββ utils/
βββ errors.ts # Error handling utilities
βββ hunk-parser.ts # Diff parsing utilities
-
Create a new branch for your feature
git checkout -b feature/your-feature-name
-
Make your changes and test them locally
-
Build and verify there are no TypeScript errors
npm run build
-
Commit your changes using conventional commits format
git commit -m "feat: add new feature" -
Push and create a pull request
git push origin feature/your-feature-name
We follow Conventional Commits:
feat:- New featuresfix:- Bug fixesrefactor:- Code changes that neither fix bugs nor add featureschore:- Maintenance tasksdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)test:- Adding or updating tests
Found a bug or have a suggestion? Open an issue with:
- Clear description of the problem or suggestion
- Steps to reproduce (for bugs)
- Expected vs actual behavior
- Your environment (Node.js version, OS, etc.)
MIT