A Python tool to detect and resolve Git merge conflicts intelligently.๐ A smart tool to help resolve Git merge conflicts using AI.
- Parses
.conflict
files containing Git-style conflict markers. - Uses local LLMs via Ollama (e.g., LLaMA 3) to suggest conflict resolutions.
- Easily extensible and works offline.
- Example conflicts provided for testing.
- Detects conflict markers in files
- Shows both versions clearly
- Uses AI (GPT) to merge smartly
- Run
main.py
- Enter path to conflicted file
- View resolution suggestions
Input file:
# --- Conflict #1 ---
# --- HEAD version ---
def greet():
print("Hello from main branch")
# --- Incoming version ---
def greet():
print("Hello from feature branch")
Output:
--- Conflict #1 ---
# HEAD:
def greet():
print("Hello from main branch")
# INCOMING:
def greet():
print("Hello from feature branch")
AI Suggested Merge:
def greet():
print("Hello from both branches - main and feature")
- GUI merge tool
- Semantic diff using AST
git clone https://github.com/kunalxt/smart-merge-conflictor.git
cd smart-merge-conflictor
pip install -r requirements.txt
MIT License
git, merge, ai, conflict-resolution, llm, openai, ollama,
smart-merge-conflictor/ โ โโโ main.py # Entry point โโโ ai_helper.py # Handles AI calls (Ollama/OpenAI) โโโ conflict_parser.py # Parses merge conflicts โโโ resolver.py # Merge logic โโโ examples/ # Sample conflict files โโโ requirements.txt # Dependencies โโโ .gitignore โโโ README.md