mk:resolving-merge-conflicts
Resolves a merge or rebase conflict hunk by hunk, preserving both sides' intent, and finishes only with your approval.
| Source | .claude/skills/resolving-merge-conflicts/SKILL.md |
| Owner | git |
| Runtime | claude-code |
| Risk | high |
What it does
Resolves a merge, rebase, cherry-pick or pull that stopped on conflicts, one hunk at a time. It keeps both sides' intent where the two are compatible and does not add features or refactor. Use it when git status shows unmerged paths or you say "resolve the conflicts" or "finish the rebase". It most often fires in Phase 5 (Ship) when mk:ship merges the base branch and hits conflicts.
When not to use
If no operation is in progress, or the request is to start a merge or ship from scratch, use mk:ship.
Usage
Run /mk:resolving-merge-conflicts while a merge or rebase is paused. There are no flags. Two rules always apply. Aborting (git merge --abort, git rebase --abort) needs your explicit direction, and so does completing the operation with a commit or git rebase --continue.
Steps
- See the state. Find out whether a merge or a rebase is in progress (
.git/MERGE_HEAD,.git/rebase-merge,.git/rebase-apply), list the files withgit diff --name-only --diff-filter=Uand read every conflicted file. During a rebaseoursis the branch being rebased onto andtheirsis your commit being replayed, the reverse of a merge. - Find the intent behind each side with
git log --merge -p -- <file>, and the merged PR and issue throughgh pr viewandgh issue view. - Resolve each hunk. Combine both intents when they are compatible. When they are not, keep the side that matches the stated goal of the merge and note what was dropped. Remove every marker, check with
git grep -nE '^(<{7}|={7}|>{7})' -- <files>, andgit addeach finished file. Do not take a whole side blindly with-X oursor-X theirs. - Discover and run the project's checks (typecheck, tests, lint or format). A file with no markers can still be broken, for example when both sides renamed a function differently.
- Show the resolved files and check results and wait for your approval. For a merge, run
git add -Athengit commit --no-edit. For a rebase, rungit add -Aandgit rebase --continue, and repeat from step 1 at each pause untilgit statusreports it finished.
Outputs
A summary with the number of conflicted files, one line per file (kept both, or chose a side and what was dropped), the check results and the finish state. On a clean tree with green checks it hands back to mk:ship or mk:verify.
Gotchas
| Situation | What to do |
|---|---|
| Unsure which intent should win | Show both intents and the merge goal and ask. Do not abort. |
| Checks fail after markers are gone | The resolution is wrong. Reread both intents. |
| A rebase keeps conflicting on the same lines | Consider git rerere. Never --skip a commit without approval. |
| Binary file conflict | Confirm with you, then pick a version with git checkout --ours or --theirs. |