resolving-merge-conflicts
Skill18 starsChanged 3 months agoMITView on GitHub
Discipline for resolving an in-progress git merge or rebase conflict, a conflict marker names two divergent intents from a shared ancestor, resolved by tracing each side back to what it was trying to accomplish, never by blindly picking one side's raw text. Use when a merge or rebase has stopped with conflict markers, when deciding whether to resolve with --ours/--theirs, or when choosing between merge and rebase for integrating a branch.
77 other projects use a version of this.
Adopted by
Most recently taken up by
- AlexisBalayre/claude-code-configtheir own version, first seen Oct 5, 2026
- KroxiDev/engineering-skillstheir own version, first seen Oct 5, 2026
- michielvandermeer/skillstheir own version, first seen Oct 4, 2026
- crbnos/carbontheir own version, first seen Oct 4, 2026
- microsoft/frontier-ghcp-rvastheir own version, first seen Oct 3, 2026
- willdady/platypustheir own version, first seen Oct 2, 2026
Used with
Projects with it also use setup-ts-deep-modules, claude-handoff and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
loulanyueSkillsetup-ts-deep-modules
Wire dependency-cruiser into a TypeScript repo so each package is a deep module — implementation hidden in subfolders, reachable only through its entry-point files. User-invoked.
Also in 13 projects that use this
qwlabsSkillclaude-handoff
Hand the current conversation off to a fresh background agent that picks up the work immediately.
Also in 14 projects that use this
RoentekSkillwriting-beats
Writing, exploit — assemble raw material into a journey of beats, grounding each term before a beat leans on it.
Also in 14 projects that use this
RoentekSkillwriting-fragments
Writing, explore — mine raw fragments, no structure yet.
Also in 14 projects that use this
qhuang20Skillmigrate-to-shoehorn
Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.
Also in 15 projects that use this
kayamanSkillgit-guardrails-claude-code
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.
Also in 21 projects that use this
- +2 more from Roentek
Other versions77 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 77
- vinvcn/mattpocock-skills-zh-CN★ 4.6ksame name
- crbnos/carbon★ 2.7ksame name
- stevesolun/ctx★ 588same name
- nodetool-ai/nodetool★ 551same name
- aws/graph-explorer★ 484same name
- ninehills/skills★ 280same name
- loulanyue/skills★ 231same name
- tt-a1i/matt-skills-with-to-goal★ 182same name
- iamyoki/qwen-image-2.1-skill★ 146same name
- willdady/platypus★ 114same name
67 more not listed
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 repository33 other files it gives its agents.
- api-design-standardsSkill
- architecture-diagramSkill
- capacity-estimationSkill
- codebase-designSkill
- code-reviewSkill
- code-style-lintSkill
- dependency-upgrade-managementSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- explain-plainlySkill
- grillingSkill
- handoffSkill
- improve-codebase-architectureSkill
- incident-responseSkill
- observabilitySkill
- project-groundworkSkill
- prototypeSkill
- release-versioningSkill
- repo-secureSkill
- repo-shipSkill
- researchSkill
- safe-deploymentSkill
- secure-codingSkill
- spec-to-ticketsSkill
- tddSkill
- teachSkill
- test-strategySkill
- to-questionnaireSkill
- triageSkill
- wait-whatSkill
- wayfinderSkill
- wizardSkill
- writing-for-agentsSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Read both sides' actual commits that touched this region (the commit message, and the rest of that commit's diff) to understand what each …
- Distinctive: line 22
Write the resolution to satisfy both intents where possible.
- Very specific: line 34
Run the test suite (tdd's regression tests are exactly what catches a syntactically-clean but behaviorally-broken resolution).
“Common” is measured: kept by at least 6 in 10 of the 12 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
Resolving Merge Conflicts
A conflict marker is not a text diff to eyeball into agreement; it's two commits that each changed the same region of a file since their shared ancestor, and git can't tell which change should win because it doesn't know what either side was trying to accomplish. Resolving it means tracing each side back to its actual intent and reconciling those intents, not picking whichever half of the marker looks less broken.
Phase 1: Understand what's actually being compared
Git's three-way merge compares three points: the merge base (the last common ancestor), HEAD (the current branch's state), and the incoming branch's state. A conflict fires specifically where both sides changed the same region relative to that shared base; git applies both sets of changes automatically everywhere they don't overlap, and only asks a human where they do.
Before resolving anything, identify all three for the conflicting hunk: what did the base look like, what did HEAD do to it, what did the incoming side do to it. A resolution written by comparing only the two conflicting sides, without the base, is missing the information that explains why they diverged.
Phase 2: Resolve hunk by hunk, by intent
For each conflict marker:
- Read both sides' actual commits that touched this region (the commit message, and the rest of that commit's diff) to understand what each side was trying to achieve, not just what the raw conflicting lines say.
- Determine whether the two intents are compatible (both can be kept, combined) or genuinely contradictory (only one can stand, or a third resolution is needed that satisfies the goal behind both).
- Write the resolution to satisfy both intents where possible. A resolution that keeps one side's text while silently dropping the behavior the other side's commit existed to add is not a resolution; it's a regression wearing the shape of one.
- Move to the next hunk. Resolve one conflict region at a time rather than skimming the whole file and guessing at a combined result; the intent-tracing in step 1 only works region by region.
Phase 3: Never blind-pick a whole side
git checkout --ours <file> or --theirs <file> at the whole-file level discards every change from the other side in that file, not just the conflicting hunks; anything the other side changed cleanly in that file (which merged silently, until this command overwrote it) is lost too. Reach for this only when the entire file is genuinely meant to come from one side wholesale (a generated file, a lockfile that should just be regenerated after), never as a shortcut to avoid reading a conflict.
Phase 4: Verify before declaring the merge/rebase done
A conflict resolved by making the text look reasonable can still be behaviorally wrong: the markers are gone but the logic combining both sides doesn't actually work. Before completing the operation:
- Build/compile if the language requires it.
- Run the test suite (
tdd's regression tests are exactly what catches a syntactically-clean but behaviorally-broken resolution). - For a resolution spanning multiple related hunks (e.g. a function signature changed in one hunk, its call sites in another), re-check that the resolved pieces are actually consistent with each other, not just each individually plausible.
Phase 5: Finish the operation; don't abort to escape a hard conflict
git merge --abort / git rebase --abort discard all resolution work done so far in this operation; reach for it only when the wrong operation was started in the first place (wrong branch, wrong base), not as an escape hatch from a conflict that's merely tedious. A genuinely hard conflict gets solved by going back to Phase 1–2 with more care (read more context, ask whoever wrote the other side's commit what its intent was), not by abandoning the merge and hoping to avoid the same conflict next time; the same two branches will produce the same conflict again.
Phase 6: Merge vs. rebase, chosen up front
| Merge | Rebase | |
| Conflict cost | resolved once, at the merge commit | may repeat, once per replayed commit that touches the conflicting region |
| History | preserved exactly as it happened, including a merge commit | rewritten: commits get new hashes |
| Safe on a shared/pushed branch | yes | no: rewriting history that others have already pulled breaks their clones |
| CI predictability | tests the exact commits that will reach production | needs re-validation after replay, since intermediate commit states changed |
Rebase only a branch that hasn't been shared, when a fully linear history is worth repeated conflict resolution across commits. Once a branch is pushed and others may have based work on it, merge is the safe default.
Done when
- Every conflict marker was resolved by tracing both sides' intent from their actual commits, not by comparing raw text alone.
- No whole-file
--ours/--theirswas used except where the entire file was genuinely meant to come from one side. - The build and full test suite pass on the resolved result, not just "no more conflict markers visible."
- The operation was completed (committed / rebase finished), not abandoned mid-way via
--abortto dodge a hard conflict.
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.

