| name | fix-merge-conflicts |
| description | Resolve Git merge, rebase, or cherry-pick conflicts by preserving intent from both sides. Use when unmerged paths or conflict markers are present, especially when you must inspect the PR title and description tied to conflicting commits before choosing a resolution. |
Resolve conflicts by intent, not by line order.
Workflow
- Run preflight conflict detection. If no local merge/rebase/cherry-pick conflicts are present, automatically fetch and merge
origin/main.
- Identify conflicted files and candidate commits.
- Map each conflicting commit to its PR.
- Read PR title and description to extract intent.
- Detect intent divergence and request user intervention.
- Resolve conflicts to preserve both intents when compatible.
- Validate behavior with targeted checks.
- Summarize decisions and any tradeoffs.
0) Preflight: Ensure a Conflict Exists
If there are no active unmerged paths, proactively merge latest origin/main to surface conflicts:
git status --porcelain
git diff --name-only --diff-filter=U
Decision rule:
- If
git diff --name-only --diff-filter=U returns files, skip auto-merge and continue to conflict analysis.
- If it returns nothing, run:
git fetch origin
git merge origin/main
Then re-check:
git diff --name-only --diff-filter=U
- If conflicts now exist, continue with the rest of this workflow.
- If still no conflicts, report that no merge conflicts were detected and stop.
1) Identify Conflict Scope
Run:
git status --porcelain
git diff --name-only --diff-filter=U
git --left-right --merge --oneline