fix-merge-conflicts
Resolve merge conflicts via rebase, validate build and tests, and finalize with a backup branch. Linear history, never force-push without explicit consent.
от fmflurry★ 173 звезды на GitHub
Установить fix-merge-conflicts в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Fix merge conflicts
If the current project has .claude/skills/fix-merge-conflicts/SKILL.md or .opencode/skills/fix-merge-conflicts/SKILL.md, read it and its references/; project specifics override this generic version.
Trigger
Branch has unresolved merge conflicts and needs a reliable path to a buildable state. Prefer rebase (linear history) over merge when safe.
Hard Rules
- Never break behavior. Minimal, correctness-first edits only. Preserve intent, both sides when safe.
- Back up first. Create a backup branch before starting; restore from it if you abort or hit verification failures.
- Abort on doubt. Any conflict about intent (not just text), verification failing twice, or data-model conflicts (EF Migrations, ORM snapshots) →
git rebase --abort, restore backup, STOP. - Stage explicit paths only. Never
git add -A,., orcommit -a. Alwaysgit add -- <path> <path>for specific files. - No hooks or config changes. Never pass
--no-verify, never usegit rebase -i, never edit git config or rerere settings. - Push only with explicit consent. Present the push command and await human approval; never push without it.
Preflight
Before starting the rebase:
- Run
git status --porcelain. Any output → STOP. Commit or stash uncommitted changes first. - Check for in-progress merge or rebase:
git rev-parse --git-path MERGE_HEADandgit rev-parse --git-path rebase-merge. If either exists, ask the human aboutgit merge --abortorgit rebase --abortto clear it. - Run
git fetch originto ensure base ref is current. - Determine the base: ask for the base ref (e.g.,
origin/main), or rungh pr view --json baseRefNameto extract it from the PR. - Record the current HEAD SHA and upstream SHA (
@{u}):git rev-parse HEADandgit rev-parse @{u}.
Backup
- Generate backup branch name:
backup/<branch-name-with-slashes-as-hyphens>-<YYYYMMDDHHMM>(lowercase). - Validate against regex
^backup/[a-z0-9]+(-[a-z0-9]+)*$. - Create backup:
git branch backup/<name>. Confirm it matches the regex. When a goal is active (.claude/state/goal.jsonexists), record it withagent-harness goal backup-add <name>.
Rebase
- Run
git rebase origin/<base>(no--rebase-merges, no-i). - If there are few commits and the conflict pattern is predictable, optionally pass
--exec "<verify-command>"to test each replayed commit. - At the first conflict stop, inspect the conflicting files.
Each Stop
During rebase conflict stops, follow this workflow for each file:
- List conflicts:
git diff --name-only --diff-filter=U. - Warn about ours/theirs: Remind that during rebase, "ours" = upstream (origin/) and "theirs" = the replayed commit (the one being re-applied).
- Read intent:
git show REBASE_HEADto see what the replayed commit intended. - Minimal edit: Edit conflicted files with the smallest, safest change. Prefer preserving both sides when the code can coexist.
- Regenerate lockfiles: After resolving code conflicts, run the package manager's lockfile refresh (e.g.,
npm install --package-lock-only,pnpm install --frozen-lockfile,yarn install --no-save) for any touched package.json or dependency files. - Verify: Run compile, lint, and relevant tests on the resolved files.
- Stage resolved files:
git add -- <resolved-file> <resolved-file> …. Never use-Aor.. - Check for lingering markers:
git diff --checkandgit diff HEADto ensure no conflict markers remain. - Continue rebase:
GIT_EDITOR=true git rebase --continue.
Abort Conditions
STOP and restore backup if:
- Data-model conflicts (EF Migrations, ORM snapshots) — high-risk; human review required.
- A conflict is about intent, not text (e.g., two branches renamed the same function differently; you cannot decide automatically).
- Verification fails twice in a row on the same stop (indication of a deeper issue).
- For SQL bootstrap/seed files: keep both rows and run the related test to verify.
- For harness JSON/JSONC: run a parse check to validate syntax.
- For ORM migration / snapshot files: STOP (data model conflicts).
When aborting: git rebase --abort, then confirm git rev-parse HEAD matches the recorded backup SHA. If needed to restore, git reset --hard backup/<name> only with explicit human consent (matches the global safety rule forbidding reset --hard without explicit ask). Report the incident and wait for human guidance.
Finish
Once all conflicts are resolved and verification passes:
- Full verification gate: Run build, lint, and full test suite on the entire rebased stack.
- Show the changes: Run
git range-diff origin/<base> backup/<x> HEADto display how each commit's diff was preserved through the rebase. - Present the push command:
git push --force-with-lease=<branch>:<recorded @{u} sha> origin <branch>. Show this command to the human and await explic
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл fix-merge-conflicts?
Resolve merge conflicts via rebase, validate build and tests, and finalize with a backup branch. Linear history, never force-push without explicit consent.
Как установить скилл fix-merge-conflicts?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл fix-merge-conflicts запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…