Skip to content

kunalxt/Smart-Merge-Conflictor

Repository files navigation

🧑‍💻Smart Merge Conflictor

A Python tool to detect and resolve Git merge conflicts intelligently.🔀 A smart tool to help resolve Git merge conflicts using AI.

🚀 Features

  • 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

🧠How to Use

  1. Run main.py
  2. Enter path to conflicted file
  3. View resolution suggestions

🧪Example

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")

Future Work

  • GUI merge tool
  • Semantic diff using AST

🛠️ Installation

git clone https://github.com/kunalxt/smart-merge-conflictor.git
cd smart-merge-conflictor
pip install -r requirements.txt

🛡 License

MIT License


📌 Topics

git, merge, ai, conflict-resolution, llm, openai, ollama,


📁 Project Structure

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

About

🚀AI-assisted tool to resolve Git merge conflicts intelligently.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages