mergefix
AI-powered git merge conflict resolver — run one command, review the diff, apply.
$ mergefix
╭──────────────────────────────────────────────────────╮
│ mergefix · 3 files · 7 conflicts · provider: claude │
╰──────────────────────────────────────────────────────╯
→ src/auth.py (2 conflicts)
Conflict 1/2
ours: main
theirs: feature/oauth
✓ Resolution:
def authenticate(user, password):
return bcrypt.checkpw(password.encode(), user.password_hash)
Conflict 2/2
ours: main
theirs: feature/oauth
✓ Resolution:
SESSION_TIMEOUT = 3600 # keep shorter timeout from main
Diff:
--- a/src/auth.py
+++ b/src/auth.py
@@ -12,7 +12,4 @@ def get_user(user_id):
-<<<<<<< HEAD
- return hashlib.md5(password.encode()).hexdigest()
-=======
- return bcrypt.checkpw(password.encode(), user.password_hash)
->>>>>>> feature/oauth
+ return bcrypt.checkpw(password.encode(), user.password_hash)
Apply resolutions to src/auth.py? [Y/n] y
✓ Applied
✅ All 3 file(s) resolved.
Run `git diff` to review changes, then `git add` to mark as resolved.
Install
pip install mergefix
Set your API key (or use Ollama for free local resolution):
export ANTHROPIC_API_KEY=your-key # Claude (default, recommended)
export OPENAI_API_KEY=your-key # or OpenAI
# or: mergefix --provider ollama # local, no API key needed
Usage
# Resolve all conflicts in the current repo (most common)
mergefix
# Resolve a specific file
mergefix src/auth.py src/db.py
# Preview resolutions without writing (safe to run anytime)
mergefix --preview
# Auto-apply all resolutions without prompting (CI/scripting)
mergefix --yes
# Keep original files as .orig backups
mergefix --backup
# Give the AI extra context about your codebase
mergefix --context "Python web app, prefer async patterns, strict type hints"
# Use local Ollama (free, no API key)
mergefix --provider ollama
# Use OpenAI
mergefix --provider openai --model gpt-4o
How it works
- Scans for files with
<<<<<<<conflict markers (or use specific files) - Parses each conflict block (supports 2-way and 3-way / diff3 style)
- Calls the AI with both sides of each conflict + surrounding context
- Displays each resolution in syntax-highlighted code blocks
- Shows a colorized unified diff of all changes
- Asks for confirmation before writing (skip with
--yes) - Writes the resolved content; optionally creates
.origbackups
The AI sees the full file context, not just the conflict lines — so it understands the surrounding code and makes semantically correct resolutions.
Supports
- Languages: Any language (Python, JS, TypeScript, Go, Rust, Java, Ruby, etc.)
- Conflict styles: 2-way (default git) and 3-way / diff3
- Providers: Claude (default), OpenAI, Ollama (local, free)
- Multiple conflicts: Resolves all conflicts in a file in one AI call
- Multiple files: Processes all conflicted files in one run
Pre-merge hook
Add to your workflow to catch issues early:
# After a merge, resolve all conflicts and review:
git merge feature-branch
mergefix --preview # preview only
mergefix # apply
git add -A
git commit
Or as a one-liner for scripting:
git merge feature-branch && mergefix --yes && git add -A && git commit -m "resolve merge conflicts"
Part of the git toolkit
mergefix is part of a suite of AI-powered git tools:
| Tool | What it does |
|---|---|
| gitbrief | Pack your git history into LLM context |
| gpr | Generate PR descriptions and commit messages |
| critiq | AI code reviewer before you push |
| standup-ai | Generate daily standups from git history |
| changelog-ai | Generate CHANGELOG from commits |
| mergefix | Resolve merge conflicts with AI |
License
MIT
Metadata
Release files for mergefix 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mergefix-0.2.0.tar.gz | 17.2 kB | Without provenance | Details for mergefix-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mergefix-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for mergefix-0.2.0-py3-none-any.whl |
Total release size: 34.2 kB
Release files / mergefix-0.2.0.tar.gz
| Download URL | mergefix-0.2.0.tar.gz |
|---|---|
| Size | 17.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd0ec09853fa543b4be470d5241e7da0dfcb4aefc879b8f4060f9b510fe7dcf2
|
|
BLAKE2b-256 checksum How to use checksums |
b86f95123241d71b746658612c8b161da2b41c986f9ba8078e06f72b6d8e8d6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.17
|
Release files / mergefix-0.2.0-py3-none-any.whl
| Download URL | mergefix-0.2.0-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3171581cb946b6711fcca213f69251160b4313552137c380f6beb515085cf619
|
|
BLAKE2b-256 checksum How to use checksums |
4021b3b2a133a3183f500a9e4331326da2dc86319e30c14e2513a48bf9c6e54f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.17
|
Security for mergefix 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.