git-conflict-resolve
Skill0 starsChanged 7 days agoMITView on GitHub
Interactively resolve git merge conflicts with mandatory per-conflict-block user approval before any change is staged or committed. Use when the user asks to "fix conflicts", "resolve merge conflicts", "help me merge X into Y", "solve the rebase conflicts", or is already mid-merge with conflict markers in files. NEVER auto-resolves and NEVER commits without explicit user confirmation — every conflict block is shown to the user with surrounding context, a proposed resolution, and the reasoning, requiring explicit Accept / Keep ours / Keep theirs / Manual choice. Second step of the git-conflict-review → git-conflict-resolve → git-pr-merge workflow; safe to run standalone if the user already started a merge.
- Commits and pushes
3 other projects use a version of this.
Adopted by
Most recently taken up by
- FuDesign2008/open-skillstheir own version, first seen Nov 6, 2026
- jmcelreavey/devhubtheir own version, first seen Oct 13, 2026
- Twigpine/openclaude-skillstheir own version, first seen May 14, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- Twigpine/openclaude-skills★ 19same name
- FuDesign2008/open-skills★ 6same name
- jmcelreavey/devhub★ 5same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- ahmed-humanizerSkill
- directSkill
- git-conflict-reviewSkill
- git-pr-mergeSkill
- pr-guardSkill
- sql-server-dbaSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. 0 are common, 11 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
After running the git-conflict-review skill and the user decided to proceed
- Distinctive: line 21
One conflict block at a time: Never bulk-resolve, never commit unseen changes.
- Very specific: line 23
Never run
git checkout --ours/--theirs <file>silently: If the user picks a side, show what's being kept and discarded first. - Distinctive: line 26
If a build/test script exists, offer to run it: after resolution and before commit — do not skip silently.
- Distinctive: line 49
If clean but conflicts are expected, first ask which direction:
- Very specific: line 53
Default to a merge (git merge --no-ff --no-commit <source>) unless the user prefers rebase.
- Distinctive: line 67
If git reports conflicts, proceed to Step 3.
- Distinctive: line 104
Move to the next block: If the file has more conflict markers, repeat for the next block.
- Distinctive: line 115
If clean, propose staging:
- Distinctive: line 140
Run only what the user approves.
- Distinctive: line 167
Never: add Co-Authored-By trailers or any signature unless the user explicitly asks.
- Very specific: line 178
No merge/rebase state files left in .git/
- Very specific: line 186
Use the AskUserQuestion tool.
- Distinctive: line 198
If the user picks "Skip", wait for the user to confirm they've edited the file before re-checking the block.
- Very specific: line 211
Delete-modify: Ask the user whether the file should still exist.
- Distinctive: line 212
Renamed files: If git tracks a rename and the other side modified the old path, present the rename context and ask whether to apply changes …
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Git Conflict Resolve
Overview
Walks the user through every conflict block in a merge or rebase, one at a time, with a proposed resolution and a mandatory approval prompt before staging anything. The skill never decides on its own. It never commits without the user saying "commit".
When to Use
- "Resolve these merge conflicts"
- "Help me finish this merge / rebase"
- The repo is in a
MERGING/REBASINGstate (.git/MERGE_HEADor.git/REBASE_HEADexists) - After running the git-conflict-review skill and the user decided to proceed
Non-Negotiable Rules
- One conflict block at a time. Never bulk-resolve, never commit unseen changes.
- Always present the proposal first, then wait for explicit user approval before writing.
- Never run
git checkout --ours/--theirs <file>silently. If the user picks a side, show what's being kept and discarded first. - Never run
git merge --continue,git rebase --continue, orgit commitwithout an explicit user "yes / continue / commit". - Never run
git push. That's the git-pr-merge skill's job. - If a build/test script exists, offer to run it after resolution and before commit — do not skip silently.
- If at any point the user says "abort", run
git merge --abort(orgit rebase --abort) and confirm the working tree is clean again.
Workflow
Step 1 — Sanity Check the State
Before touching anything:
git status --porcelain=v2 --branch
git rev-parse --git-dirDetermine which of these the user is in:
| State | Signal | Continue command |
| Mid-merge | .git/MERGE_HEAD exists | git merge --continue |
| Mid-rebase | .git/rebase-merge/ or .git/rebase-apply/ exists | git rebase --continue |
| Mid-cherry-pick | .git/CHERRY_PICK_HEAD exists | git cherry-pick --continue |
| Clean, no merge | Neither exists | The user wants to start a merge — see Step 2 |
If clean but conflicts are expected, first ask which direction:
Merge <source> into <target>, or rebase <source> onto <target>?Default to a merge (git merge --no-ff --no-commit <source>) unless the user prefers rebase. --no-commit is mandatory — never let git auto-commit a clean merge before the user has reviewed.
Step 2 — Initiate the Merge (only if starting fresh)
git fetch --all --prune
git switch <target>
git pull --ff-only
git switch <source>
git merge --no-ff --no-commit <target>
# or
git rebase <target>If git reports conflicts, proceed to Step 3. If clean, stop and tell the user there's nothing to resolve — they can commit directly (with their approval) or hand off to git-pr-merge.
Step 3 — Enumerate the Conflicted Files
git diff --name-only --diff-filter=UFor each file, also note its rough conflict-block count:
grep -c '^<<<<<<<' <file>Tell the user: "N files have conflicts, totalling M conflict blocks. I will walk you through one block at a time."
Step 4 — For Each File, Walk Each Conflict Block
For every conflict block, follow this exact loop:
- Show the block in context — read the file and print the conflict markers plus ~10 lines above and below.
- Describe each side in one sentence:
<<<<<<< HEAD/=======→ "Ours" — what's currently on the branch being merged into.=======/>>>>>>> <ref>→ "Theirs" — what's being merged in.
- Propose a resolution with one short paragraph of reasoning. Pick from:
- Accept ours (discard theirs) — when ours has the newer/correct logic.
- Accept theirs (discard ours) — when theirs supersedes.
- Combine — write the merged version explicitly.
- Need user judgment — when both sides have legitimate intent and you can't tell which wins.
- Show the proposed final state of that block (no markers, real code).
- Ask for approval via AskUserQuestion — see shape below. Wait. Never act until the user picks.
- Apply the chosen resolution with the
Edittool — replace only the marked block. Do not stage yet. - Move to the next block. If the file has more conflict markers, repeat for the next block. Otherwise move to the next file.
Step 5 — After Each File Is Clean
Once a file has no more <<<<<<< markers:
git diff --check <file> # warns about trailing whitespace + leftover markers
grep -n '^<<<<<<<\|^=======\|^>>>>>>>' <file> # belt-and-braces checkIf clean, propose staging:
"File
<path>is fully resolved. Stage it? (yes / no)"
Only after approval:
git add <file>Step 6 — After All Files Are Resolved
Show a summary:
git status
git diff --cached --statOffer to run project verification before the commit. Detect by file presence:
| Detected | Suggest |
composer.json + phpunit.xml | php artisan test --filter=... or full suite |
package.json with test script | npm run test:ci or npm run lint |
Cargo.toml | cargo test --no-run then cargo test |
go.mod | go build ./... then go test ./... |
Run only what the user approves. If something fails, surface the failure verbatim and ask the user how to proceed — do not silently re-edit.
Step 7 — Compose the Commit Message and Commit
Suggest a commit message body. For a merge:
Merge branch '<source>' into <target>
- Resolved N conflicts across M files
- Key decisions: <one-line summary of non-trivial choices>For a rebase, no explicit commit is needed — just git rebase --continue (each commit is replayed).
Show the proposed message and ask for approval. After explicit user "yes":
# Merge
git commit -m "$(cat <<'EOF'
<message>
EOF
)"
# Rebase
git rebase --continueNever add Co-Authored-By trailers or any signature unless the user explicitly asks.
Step 8 — Verify Cleanliness and Hand Off
git status
git log --oneline -5Confirm:
- Working tree clean
- No merge/rebase state files left in
.git/ - The latest commit is the expected merge commit (or rebased tip)
Tell the user:
"Resolved and committed locally. Next step: run the git-pr-merge skill to push, open a PR, review it, and squash-merge."
Approval Prompt Shape
Use the AskUserQuestion tool. Standard four options:
Question: How should we resolve this conflict in <file> at line <N>?
Header: Conflict <i>/<total>
Options:
1. Accept proposed (combined) — Use the merged version I just showed.
2. Keep ours — Discard the incoming changes for this block.
3. Keep theirs — Discard our changes for this block.
4. Skip — I'll edit manually — Pause so the user can edit the file directly.If the user picks "Skip", wait for the user to confirm they've edited the file before re-checking the block.
What This Skill Does NOT Do
- Does not start a merge without the user's explicit choice of source/target.
- Does not stage, commit, or push without per-step user approval.
- Does not run
--abort,reset --hard,clean -fd, or any destructive recovery unless the user types "abort". - Does not decide whether the merge was a good idea — escalates philosophical questions back to the user.
- Does not open the PR (→ git-pr-merge).
Edge Cases
- Binary conflicts:
Edittool cannot fix these. Offer Keep ours / Keep theirs explicitly viagit checkout --ours <file>or--theirs <file>and require approval before running. - Delete-modify: Ask the user whether the file should still exist. If keep → use
git add <file>. If delete → usegit rm <file>. - Renamed files: If git tracks a rename and the other side modified the old path, present the rename context and ask whether to apply changes to the new path.
- Generated files (lockfiles, OpenAPI specs, codegen output): Recommend regenerating instead of hand-editing. Show the regenerate command (
composer update --lock,npm install, the project's codegen script, etc.) and require approval. - Submodules: Outside scope. Tell the user to handle submodule pointer manually.
Resources
See references/resolution-patterns.md for concrete worked examples of common conflict shapes (import-block conflicts, route conflicts, lockfile conflicts, translation-file conflicts).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

