Command Palette

Search for a command to run...

Назад к скиллам
скилл № 49642

conflict-resolution

Use when the user asks to resolve a merge or rebase conflict, read conflict markers, ours vs theirs, git rerere, abort a rebase, recover lost commits with…

БесплатноБез исполняемых скриптов
j4flmaoот j4flmao★ 47 звёзд на GitHub

Установить conflict-resolution в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Git Conflict Resolution and Recovery

Purpose

Conflicts are Git asking a human to combine two edits of the same region; most bad resolutions come from not seeing the common ancestor or confusing "ours" and "theirs". Most "lost work" is still recoverable from the reflog. This skill gives a safe procedure for both.

Agent Protocol

Trigger

"merge conflict", "rebase conflict", "conflict markers", "ours vs theirs", "git rerere", "abort rebase", "lost commits", "git reflog", "undo a merge", "revert a merge", "detached HEAD", "recover branch", "git bisect", "cherry-pick conflict".

Input Context

  • Operation in progress (git status output: merge, rebase, cherry-pick, revert, stash pop)
  • Conflicted files and their type (source, lock file, generated, binary)
  • Whether the affected commits are already pushed/shared

Output Artifact

Step-by-step commands with explanation, and the resolved code when the conflict content is provided. No file unless requested.

Response Format

State: {operation in progress, branch, conflicted files}
Meaning: {ours = ..., theirs = ...}
Steps: {numbered commands}
Resolution: {combined code / which side and why}
Verify: {build/tests, git diff checks}
Safety net: {how to undo this}

1. Why Conflicts Happen

Git merges three versions: the merge base (common ancestor), ours, and theirs. Changes to different regions combine automatically; overlapping changes to the same lines (or edit vs delete, or both adding the same file) become conflicts. The default merge strategy since Git 2.34 is ort.

2. See the Ancestor: zdiff3 Markers

git config --global merge.conflictStyle zdiff3      # Git 2.35+; use diff3 on older Git
<<<<<<< HEAD
timeout = 30
||||||| merged common ancestors
timeout = 10
=======
timeout = 10
retries = 3
>>>>>>> feature/retries

With the base visible you can tell: ours changed the timeout, theirs added retries → keep both: timeout = 30 and retries = 3. Without the base section this looks like an either/or choice.

3. Ours vs Theirs

Operation --ours / HEAD --theirs
git merge feature (on main) main (current branch) feature
git rebase main (on feature) main + already-replayed commits (the new base) your feature commit being replayed
git cherry-pick X current branch commit X
During a rebase the labels feel reversed because Git checks out the upstream and replays your commits onto it.

Take one side for a whole file: git checkout --ours -- path / git checkout --theirs -- path (or git restore --ours/--theirs -- path), then git add path.

4. Resolution Procedure

git status                                  # what operation, which files
git diff                                    # combined diff of conflicts
git mergetool                               # optional: configured 3-way tool (VS Code, IntelliJ, Meld, Beyond Compare)
# edit files, remove all markers
git diff --check                            # catches leftover conflict markers/whitespace
<build and run tests>
git add <files>
git merge --continue | git rebase --continue | git cherry-pick --continue
  • Abort cleanly any time before committing: git merge --abort, git rebase --abort, git cherry-pick --abort.
  • During a long rebase, git rebase --skip drops the current commit (only if its change is truly redundant).
  • Understand the intent of both sides (read the commits: git log --merge -p -- path) instead of mechanically picking one.

5. Special Files

File type Approach
Lock files (package-lock.json, pnpm-lock.yaml, yarn.lock, poetry.lock, uv.lock, Cargo.lock) resolve the manifest (package.json, pyproject.toml), take one side of the lock, then regenerate with the package manager (npm install, pnpm install, uv lock, cargo update -p ... only if needed) and commit the result
Generated code / snapshots regenerate from sources, do not hand-merge
Binary files (images, design files) choose a side (--ours/--theirs); consider Git LFS locking for binaries
Migrations with sequence numbers renumber/re-generate the newer migration so order stays linear
Renames + edits ort detects most renames; if not, apply the edit to the new path manually
Optional automation: .gitattributes merge drivers (e.g. merge=union for append-only changelogs; custom drivers for lock files such as npm-merge-driver-style tools).

6. rerere: Reuse Recorded Resolution

git config --global rerere.enabled true

Git records how you resolved a conflict hunk and reapplies it when the same conflict reappears (repeated rebases, re-merging a topic branch). Review reapplied results; git rerere forget path discards a bad recording.

7. Reduce Future Conflicts

Small, short-lived branches; rebase/merge main frequently; avoid mass reformatting mixed with logic changes (format in a sep

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл conflict-resolution?

Use when the user asks to resolve a merge or rebase conflict, read conflict markers, ours vs theirs, git rerere, abort a rebase, recover lost commits with reflog, undo or revert a merge, detached HEAD or git bisect. Produces step-by-step conflict resolution and recovery commands. Not for choosing a branching model (use advanced-workflows).

Как установить скилл conflict-resolution?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл conflict-resolution запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить conflict-resolution с