merge-conflict-resolver
Skill5 starsChanged 18 days agoMITView on GitHub
Resolves git merge, rebase, cherry-pick, revert and stash pop conflicts by working out what each side meant and keeping both intents, instead of picking ours or theirs. A read-only script reports the operation in progress and what "ours" and "theirs" mean for it (they swap during a rebase), each conflicted file and its kind (content, add/add, modify/delete, rename, binary), every hunk's ours, base and theirs text, and the commits on each side that touched the file. Lockfiles such as package-lock.json, yarn.lock or Cargo.lock are regenerated with the package manager, never hand-merged, and a check mode confirms no conflict markers are left before git add and continue. Use when the user asks to resolve or fix merge conflicts, says a rebase or cherry-pick stopped with CONFLICT, sees <<<<<<< HEAD markers in a file, asks whether to keep ours or theirs, has a conflicted package-lock.json, or wants help finishing a stuck merge or rebase.
- Deletes or force-pushes
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- omerchn/skillstheir own version, first seen Oct 11, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- omerchn/skills★ 1same 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 repository56 other files it gives its agents.
- docs/llms.txtllms.txt
- a11y-fixerSkill
- ad-copy-generatorSkill
- agent-guardrailsSkill
- agent-memory-keeperSkill
- ai-slop-detectorSkill
- api-to-sdkSkill
- app-store-optimizerSkill
- architecture-doctorSkill
- brand-voice-guideSkill
- bug-detectiveSkill
- changelog-from-gitSkill
- codebase-explainerSkill
- codebase-time-machineSkill
- commit-craftSkill
- competitor-spySkill
- content-repurposerSkill
- cost-cutterSkill
- demo-recorderSkill
- dependency-doctorSkill
- dockerize-anythingSkill
- durable-agent-workflowsSkill
- e2e-flow-testerSkill
- email-campaign-writerSkill
- env-secrets-guardSkill
- gh-actions-auditorSkill
- hook-generatorSkill
- incident-commanderSkill
- influencer-outreachSkill
- instagram-growth-managerSkill
- landing-page-roasterSkill
- launch-post-writerSkill
- meeting-notes-to-ticketsSkill
- migration-wizardSkill
- plan-grillerSkill
- prompt-injection-scannerSkill
- pr-reviewer-proSkill
- readme-glow-upSkill
- roast-my-githubSkill
- screenshot-to-componentSkill
- seo-blog-writerSkill
- skill-creator-proSkill
- skill-finderSkill
- skills-doctorSkill
- social-analytics-reporterSkill
- social-media-calendarSkill
- social-media-managerSkill
- sql-optimizerSkill
- startup-idea-validatorSkill
- tdd-loopSkill
- terse-modeSkill
- test-gap-hunterSkill
- tiktok-viral-creatorSkill
- ui-tasteSkill
- youtube-script-writerSkill
- youtube-seo-optimizerSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
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
- could be automatic: a setting could enforce it
- Distinctive: line 28
Write one line per hunk, such as "ours: X because Y.
- Distinctive: line 42
Remove every marker line and keep the code consistent: one name, one signature, imports that match what is used.
- Distinctive: line 46
Never merge lockfile hunks by hand.
- Very specific: line 50
Run the printed command, for example npm install --package-lock-only, pnpm install, yarn install, cargo update --workspace, poetry lock, uv …
- Distinctive: line 51
Check the diff of the lockfile against the long-lived branch: only the other side's dependency changes should appear.
- Very specific: line 73
Run git checkout --ours/--theirs, -X ours/theirs or -s ours on whole files or the whole merge without reading every hunk.
- Distinctive: line 74
Delete or comment out either side's code to make the build pass.
- Distinctive: line 75
Run git rebase --skip. It drops the whole commit being replayed.
- Distinctive: line 78
Commit, push or force-push unless the user asked for it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Merge Conflict Resolver
A conflict means two changes touched the same lines, usually for different reasons. A good resolution keeps both reasons unless one makes the other obsolete. Picking a whole side without reading it loses someone's work.
1. See what is in conflict
python3 scripts/conflicts.py # operation, sides, files, hunks, commits per side
python3 scripts/conflicts.py src/api.ts # only these paths
python3 scripts/conflicts.py --json # machine-readable, hunk text never cutThe script only reads. Start with its operation line, for example rebasing feature onto main, commit 3/7. During a rebase, ours is the branch you are rebasing onto and theirs is your own commit being replayed. During a revert, theirs is the code as it was before the reverted commit. A conflicted git stash pop leaves no state file, so the script recognises it by the Updated upstream and Stashed changes marker labels.
Exit codes: 0 nothing to resolve or clean · 1 conflicts present · 2 not a git repository or a git error.
2. Work out what each side meant
For each content hunk, before editing anything, compare ours and theirs against base. Base is what both sides started from, so it shows what each one changed. The script takes base from diff3/zdiff3 markers or rebuilds it from the index. To get it in the file itself next time, set git config merge.conflictStyle zdiff3 (git 2.35 or later).
Then read the commits listed for each side with git show <sha>. The message, the rest of the diff and any linked issue say why the line changed: a bug fix, a rename, a new parameter, a refactor that moved the code. Look past the hunk too, at callers of a renamed function, tests either side added, and the same identifier elsewhere.
Write one line per hunk, such as "ours: X because Y; theirs: Z because W; keep: ...". If you can't say why one side made its change, find out before choosing.
3. Combine the intents
| Situation | Resolution |
| Both added entries (imports, routes, enum values, list items) | Keep both, drop exact duplicates, follow the file's ordering |
| One side renamed or moved code, the other changed its body | Apply the body change at the new name or location |
| One side refactored, the other fixed a bug in the old version | Re-apply the fix inside the refactored code |
Both changed the same value (timeout = 45 vs 120) | Choose by intent from the commit messages. If it is still unclear, ask the user |
| modify/delete | Find out why it was deleted. If it moved, port the change to the new place. If the feature was removed, drop the change and say so |
| rename (rename/rename, rename/delete) or add/add | Choose one path and one content, then update references to the other |
| Binary file | Ask which version is right, then git checkout --ours -- <path> or --theirs |
Remove every marker line and keep the code consistent: one name, one signature, imports that match what is used.
4. Lockfiles and generated files
Never merge lockfile hunks by hand. The script flags them and prints the regenerate command.
- Resolve the manifest first (
package.json,Cargo.toml,pyproject.toml,go.mod,Gemfile) using step 2. - Take the lockfile from the long-lived branch:
git checkout --ours -- package-lock.jsonwhen rebasing onto main,--theirswhen merging main into your branch. - Run the printed command, for example
npm install --package-lock-only,pnpm install,yarn install,cargo update --workspace,poetry lock,uv lock,bundle installorgo mod tidy. Run it from the directory that holds the manifest. These keep versions that are already locked and resolve only what the manifest changed. - Check the diff of the lockfile against the long-lived branch: only the other side's dependency changes should appear.
Generated files (minified bundles, source maps, Jest snapshots, files whose header says generated or DO NOT EDIT) work the same way: resolve the sources, then re-run the generator.
5. Verify
python3 scripts/conflicts.py --check # exit 1 lists file:line of marker sets left (working tree or staged) and unmerged pathsA Markdown or reST ======= underline is not reported; only a full <<<<<<<, =======, >>>>>>> set counts. Then run the project's build, type check and the tests closest to the changed files. If something fails, fix it according to the intents from step 2.
6. Mark resolved and continue
git add <file> for each resolved file, git rm <file> where removing it was the right call. Then run the continue command the script printed (git rebase --continue, git merge --continue, git cherry-pick --continue, ...). A rebase can stop again on the next commit: go back to step 1. After a stash pop, the stash is kept; suggest git stash drop once the user confirms the result. If the user only asked for the files to be resolved, stop after git add and let them continue.
Report
Per file and hunk: what each side meant, what you kept, and which choices were judgement calls the user should check. Then the verification commands and their results.
Do not
- Run
git checkout --ours/--theirs,-X ours/theirsor-s ourson whole files or the whole merge without reading every hunk. - Delete or comment out either side's code to make the build pass.
- Run
git rebase --skip. It drops the whole commit being replayed. Do it only if the user agrees the commit is no longer needed. git adda file that still has markers. Run--checkfirst.- Abort the operation or reset the tree on your own.
git merge --abort,git rebase --abortandgit reset --hardthrow away resolution work, so the user decides. - Commit, push or force-push unless the user asked for it.
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.

