AIMerge is an intelligent Git merge conflict resolver that uses Google Gemini AI to automatically suggest and resolve merge conflicts. Say goodbye to manually resolving complex merge conflicts!
- ๐ Automatic Conflict Detection - Scans your Git repository for merge conflicts
- ๐ค AI-Powered Resolution - Uses Google Gemini to intelligently resolve conflicts
- ๐จ Color-Coded Diffs - Beautiful terminal output with syntax highlighting
- ๐ฌ Interactive Mode - Review, edit, or accept AI suggestions
- โก Auto Mode - Batch resolve multiple conflicts automatically
- ๐ Safe Backups - Automatically backs up files before making changes
- ๐ Progress Tracking - Shows resolution statistics and progress
pip install aimerge
uv add aimerge
git clone https://github.com/olllayor/aimerge.git
cd aimerge
pip install -e .
-
Get a Google Gemini API Key:
- Visit Google AI Studio
- Create a new API key
- Keep it handy for the next step
-
Configure AIMerge:
# Set your API key (one-time setup) aimerge --set-api-key YOUR_GEMINI_API_KEY # Or set as environment variable export GEMINI_API_KEY="your-api-key-here"
Navigate to your Git repository with merge conflicts and run:
aimerge
aimerge
- Review each conflict individually
- Choose to accept, skip, or edit AI suggestions
- Get colored diffs showing the changes
aimerge --auto
- Automatically resolves all conflicts without prompts
- Great for trusted repositories or batch processing
aimerge --help
- Detection: AIMerge scans your Git repository for files with merge conflicts
- Analysis: Each conflict is analyzed with surrounding context
- AI Resolution: Google Gemini generates intelligent merge suggestions
- Review: You can review, edit, or accept each suggestion
- Application: Resolved conflicts are applied and staged in Git
# You have merge conflicts after a git merge
$ git merge feature-branch
Auto-merging src/utils.py
CONFLICT (content): Merge conflict in src/utils.py
# Run AIMerge to resolve conflicts
$ aimerge
INFO: AIMerge initialized with your Google Gemini API key.
INFO: Found 1 conflicted file: src/utils.py
โญโ Conflict 1/1 in src/utils.py โโฎ
โ Current (HEAD): โ
โ def calculate_sum(a, b): โ
โ return a + b โ
โ โ
โ Incoming (feature-branch): โ
โ def calculate_sum(a, b, c=0): โ
โ return a + b + c โ
โ โ
โ AI Suggestion: โ
โ def calculate_sum(a, b, c=0): โ
โ """Calculate sum with optional third parameter.""" โ
โ return a + b + c โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Accept this resolution? [y/n/e/s]: y
โ
Resolved 1/1 conflicts
AIMerge supports several configuration options:
export GEMINI_API_KEY="your-api-key" # Required: Your Gemini API key
export AIMERGE_MODEL="gemini-1.5-pro" # Optional: Specific model version
aimerge --help # Show help
aimerge --set-api-key KEY # Set API key
aimerge --auto # Auto-resolve all conflicts
aimerge --model gemini-1.5-flash # Use specific model
git clone https://github.com/olllayor/aimerge.git
cd aimerge
# Install with development dependencies
pip install -e ".[dev]"
# Or using uv
uv sync
pytest
aimerge/
โโโ src/
โ โโโ cli.py # Main CLI interface
โ โโโ conflict_detector.py # Git conflict detection
โ โโโ conflict_parser.py # Conflict parsing logic
โ โโโ gemini_resolver.py # AI resolution logic
โ โโโ git_integration.py # Git operations
โโโ tests/ # Test suite
โโโ pyproject.toml # Project configuration
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- AIMerge is in beta. Always review AI suggestions before accepting them.
- Keep backups of important code before using auto-mode.
- AI suggestions may not always be perfect - use your judgment.
- Google Gemini AI for providing the intelligent conflict resolution
- The Git community for making version control awesome
- All contributors and users of this project
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with โค๏ธ for developers who hate merge conflicts