merge-conflict-resolution
Skill0 starsChanged 4 months agoMITView on GitHub
Use when resolving git merge/rebase/cherry-pick conflicts — especially resolving "all in favor of one side", resolving with a script or bulk command, or resolving multiple conflict blocks in one file. Also use before committing any conflict resolution, and when reviewing a merge someone (or some agent) claims is done. Triggers — "разреши конфликт", merge conflict markers, checkout --theirs/--ours, "возьми вариант ветки X".
4 other projects use a version of this.
Adopted by
Most recently taken up by
- oocx/tfplan2mdtheir own version, first seen Oct 8, 2026
- anur4ag/pr-completiontheir own version, first seen Sep 14, 2026
- kimtth/agent-skill-100-lines-or-lesstheir own version, first seen Jun 26, 2026
- mlopscommunity/Coding-Agents-Conference-skillstheir own version, first seen Mar 4, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- oocx/tfplan2md★ 174same name
- mlopscommunity/Coding-Agents-Conference-skills★ 38same name
- anur4ag/pr-completion★ 4same name
- kimtth/agent-skill-100-lines-or-less★ 2same 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 repository9 other files it gives its agents.
- docx-analytical-ruSkill
- docx-ruSkill
- looperSkill
- managerSkill
- npm-publish-smokeSkill
- skill-lifecycleSkill
- team-worklogSkill
- verify-doneSkill
- worktree-dispatchSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
All green, data lost. This exact sequence shipped a deleted "critical security notice" line in a 17-second baseline test, and lost README …
- Very specific: line 37
Keep the pre-resolution file: cp file file.conflicted before touching it.
- Distinctive: line 53
Only after all three: git add + commit.
- Very specific: line 90
No pre-resolution copy and no checkout -m recovery before verifying
“Common” is measured: kept by at least 6 in 10 of the 4 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
merge-conflict-resolution — resolve blocks, never replace files
Overview
A merge conflict file has THREE kinds of content: conflict blocks (both sides shown), auto-merged lines git already combined for you, and untouched context. Every data-loss incident in this class comes from treating the file as two-kinds: a resolver that replaces the whole file, or a script that eats the lines between blocks.
Core rule: resolve conflict BLOCKS. Anything that replaces the FILE destroys auto-merged work — silently, with a clean git status.
The trap that passes every naive check
git checkout --theirs <file> does NOT mean "take their side of the conflicts". It replaces the whole file with their version — every line the other side added outside the conflicts is gone. Then:
git status— clean ✓ (loss is staged, status can't see it)git diff --check— no markers ✓git log --graph— proper merge commit, two parents ✓
All green, data lost. This exact sequence shipped a deleted "critical security notice" line in a 17-second baseline test, and lost README lines twice in production.
Doing it right
| Intent | Correct tool |
| All conflicts in favor of one side, merge not started yet | git merge -X theirs <branch> (block-level; keeps auto-merged lines) |
| All conflicts one side, conflict already open | Re-do properly: git merge --abort && git merge -X theirs <branch>. Or edit only the blocks. |
| Mixed choices per block | Edit each block (by hand or state-machine script), never whole-file commands |
| Whole file genuinely from one side (binary, generated) | git checkout --theirs — the ONLY case it's correct; say so in the commit message |
Script rules (if you automate block editing):
- Process line-by-line with a state machine (
<<<<<<<opens,>>>>>>>closes). Never a regex spanning from<<<<<<<to>>>>>>>— greedy or multiline matching eats everything between two blocks. This is the production bug this skill exists for. - Fail fast on anything unmapped (unknown section, nested markers) — crash beats guess.
- Keep the pre-resolution file:
cp file file.conflictedbefore touching it.
Verify before commit — three checks, all mandatory
# 1. No markers anywhere in the repo (not just the file you edited)
git -C "$R" diff --check && git -C "$R" grep -nE '^(<<<<<<<|=======|>>>>>>>)' -- . ; # grep must find nothing
# 2. NO LINE OUTSIDE CONFLICT BLOCKS WAS LOST — the check that catches --theirs and greedy regex
awk '/^<<<<<<</{c=1} /^>>>>>>>/{c=0;next} !c' file.conflicted > /tmp/outside
grep -Fxvf <resolved-file> /tmp/outside # must print NOTHING; every printed line was eaten
# (file.conflicted is the copy you kept; recover one with `git checkout -m <file>` if you didn't)
# 3. Each block resolved to the INTENDED side — grep the distinctive line of each choiceOnly after all three: git add + commit. If you resolved during a review/приёмка of someone else's merge — run the same three checks on their result; a clean status is not evidence.
Acceptance merges — merging someone's finished branch
Same discipline, different trap: here nothing conflicts, so nothing feels dangerous. Two real incidents in one:
Pre-flight (before any merge command):
git -C "$R" status --short # whose tree is this? CLEAN? In multi-agent setups the
# checkout may belong to a LIVE agent mid-task — uncommitted
# files here mean STOP, not stash.
git -C "$R" branch --show-current # you merge INTO where HEAD points. If it's not the target
# branch, checkout first — a merge "into main" executed on
# someone's work-branch lands there silently and looks fine.Post-push (after any push):
git -C "$R" ls-remote origin <target-branch> # compare to local SHA yourselfThe push command's own output is not evidence: Everything up-to-date prints on a no-op push (wrong branch pushed = nothing rejected, nothing transferred, success-looking output, remote unchanged). Report the ls-remote SHA, not the push output.
Rationalizations — heard in real incidents
| Excuse | Reality |
"checkout --theirs = take theirs in the conflicts" | It takes theirs for the FILE. Auto-merged lines from the other side die. |
"git status is clean, работа сдана" | Status sees staged-ness, not meaning. The loss is inside what you staged. |
| "Merge commit has two parents, graph is correct" | Graph proves ancestry, not content. |
| "It's mechanical, one-two commands, 13 more repos waiting" | The 17-second version of this job deleted a security notice. Check #2 costs 5 seconds. |
| "My resolver script printed 'resolved 3 blocks'" | It resolved what it matched. Verify what it didn't match survived. |
Red flags — STOP
- Typing
checkout --ours/--theirson a text file while auto-merged changes exist - A conflict-parsing regex with
[\s\S]*?or multiline mode across markers - Declaring a merge done having checked only
git status/git log - No pre-resolution copy and no
checkout -mrecovery before verifying - Accepting an executor's merge because their report says "conflicts resolved"
- Typing a merge command without knowing what
branch --show-currentsays - Reporting a push as done based on the push command's output instead of
ls-remote
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.

