DEV Community

Cover image for Merge Resolver: Automatic Git Conflict Resolution Using AI
Roshan Acharya
Roshan Acharya

Posted on

Merge Resolver: Automatic Git Conflict Resolution Using AI

GitHub Copilot CLI Challenge Submission

This is a submission for the GitHub Copilot CLI Challenge

Merge conflicts are one of the most common pain points in software development.

When multiple developers work on the same codebase, resolving conflicts manually can be tedious, error-prone, and time-consuming.

What I Built

Git Merger AI is designed to make conflict resolution:

  • πŸ€– AI-Powered: Sends conflicting code blocks to Copilot for smart resolutions.
  • πŸ’Ύ Safe: Automatically backs up files before modifying them.
  • πŸ” Preview Mode: Lets you see AI’s suggested changes before committing.
  • ⚑ Cross-Platform: Works on Linux, macOS, and Windows.
  • πŸ“Š Conflict Summary: Shows exactly how many blocks were resolved per file.

The goal: let developers focus on building features, not spending hours resolving conflicts.

How It Works

  1. Detect all conflicted files in the repo using Git commands.
  2. Parse each file for conflict blocks using a robust regex parser.
  3. Send each block to GitHub Copilot CLI with a concise prompt.
  4. Replace the conflict block with the AI-generated solution.
  5. Stage the file and optionally auto-commit the changes.
  6. Provide a clean summary of all resolved conflicts.

Demo

Github Repository : https://github.com/roshan-acharya/Merge-Resolver

Screenshot

Merger-Resolver Preview Model
Merge-Resolver Preview Mode

Merge-Resolver Resolving Merge

Merge-Resolver Resolving Merge

Merged File Output

Merged File Output

My Experience with GitHub Copilot CLI

Using GitHub Copilot CLI was a game-changer:

  • It intelligently suggested merged code, combining multiple features automatically.

  • Allowed me to script the full workflow from detection β†’ resolution β†’ commit.

  • Helped me iterate faster and reduce manual conflict errors.

Extra effort I put in:

  • Backup system to prevent accidental loss

  • Preview mode for safe β€œdry-run” testing

  • Robust regex parser for multi-line and indented conflicts

  • Cross-platform support

This project demonstrates how AI can make DevTools smarter, reducing developer friction in real workflows.

Installation & Usage

Clone Repository and create CLI tool:

git clone https://github.com/roshan-acharya/Merge-Resolver
pip install -r requirements.txt
cd Merge-Resolver
pip install -e .
Enter fullscreen mode Exit fullscreen mode

Preview Mode

git-merger --p
Enter fullscreen mode Exit fullscreen mode

Run the resolver when conflict occur:

git-merger
Enter fullscreen mode Exit fullscreen mode

Key Takeaways

  • Merge conflicts don’t have to be painful β€” AI can handle them.

  • GitHub Copilot CLI enables automation at the command line, not just IDEs.

  • Combining regex parsing + AI resolution + Git automation creates a powerful DevTool.

Team Member :

@loveless_bhartal_92b27cd9

Top comments (0)