A Python tool to detect and resolve Git merge conflicts intelligently.🔀 A smart tool to help resolve Git merge conflicts using AI.
- Parses
.conflictfiles 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