git-conflicts
БесплатноБез исполняемых скриптовНе проверенResolve merge conflicts file-by-file. Use when a merge/rebase has conflicts, a PR can't merge, "fix conflicts" is requested, or branches have diverged.
от laurigates★ 61 звезда на GitHubОб этом скилле
/git:conflicts
Resolve merge conflicts using modern git features.
When to Use This Skill
| Use this skill when... | Use git-ops agent instead when... |
|---|---|
| Merge or rebase produced conflicts | Complex multi-branch cherry-pick across many commits |
| PR shows "can't merge" / "fix conflicts" | Conflicts require deep business logic understanding |
| Config files (JSON, YAML, lockfiles) diverged | Interactive rebase with squash/fixup needed |
Need to accept one side wholesale (--ours/--theirs) |
Architectural redesign spanning many files |
Context
- Current branch: !
git branch --show-current - Git status: !
git status --porcelain=v2 --branch - Merge state: !
find .git -maxdepth 1 -name 'MERGE_HEAD' -o -name 'REBASE_HEAD' -o -name 'rebase-merge' -o -name 'rebase-apply' - Conflicted files: !
git diff --name-only --diff-filter=U - Conflict style: !
git config --default '' merge.conflictStyle - Rerere enabled: !
git config --default '' rerere.enabled - Git version: !
git version
Parameters
Parse these from $ARGUMENTS:
$1: File path (resolve single file) OR PR number (fetch and merge base branch)--ours: Accept current branch version for all conflicts--theirs: Accept incoming branch version for all conflicts--push: Push after resolution is committed
Execution
Execute this conflict resolution workflow:
Step 1: Assess the situation
- Check context for existing merge/rebase state (
MERGE_HEAD,REBASE_HEAD,rebase-merge,rebase-apply) - If PR number provided and no active merge state:
- Get PR details:
gh pr view <number> --json headRefName,baseRefName,mergeable - Fetch base:
git fetch origin <base-branch> - Pick the sync method:
- Default — rebase:
git rebase origin/<base-branch>. A merge commit in a PR branch forces the PR to squash-merge (rule 4 ingithub-pr-title→ merge-strategies.md), so rebasing keeps the PR rebase-eligible. - Fallback — merge:
git merge origin/<base-branch> --no-ffwhen the branch is shared (someone else has commits on it, or another PR is based on it) or a rebase is not allowed to force-push.
- Default — rebase:
- If the sync succeeds cleanly, report "No conflicts" and exit
- Get PR details:
- If no PR number and no active merge state, detect from current branch:
gh pr list --head $(git branch --show-current) --json number,baseRefName,mergeable- Use the detected PR number and base branch; proceed as above
- List conflicted files:
git diff --name-only --diff-filter=U - If no conflicted files found, report current status and exit
Step 2: Configure zdiff3 (if not set)
Check the conflict style from context. If merge.conflictStyle is not zdiff3:
- Set for this repo:
git config merge.conflictStyle zdiff3 - Re-checkout conflicted files with zdiff3 markers:
git checkout --conflict=zdiff3 -- <file>for each conflicted file - Enable rerere if not already:
git config rerere.enabled true - Enable rerere autoupdate:
git config rerere.autoupdate true(auto-stages files resolved by rerere)
This gives three-way conflict markers with the common ancestor, compacted by removing shared lines at conflict boundaries. Much easier to resolve than the default two-way markers.
Step 3: Resolve conflicts
If --ours flag: Accept current branch for all conflicted files:
git restore --ours -- <file> # for each file
git add <file>
If --theirs flag: Accept incoming branch for all conflicted files:
git restore --theirs -- <file> # for each file
git add <file>
Otherwise, resolve each file intelligently:
For each file from git diff --name-only --diff-filter=U:
- Read the file — with zdiff3, conflict markers look like:
<<<<<<< HEAD (current branch changes) ||||||| (common ancestor) (what the code looked like before both changes) ======= (incoming changes) >>>>>>> branch-name - The
|||||||section (common ancestor) shows what both sides started from — use it to understand intent - Apply resolution strategy by file type:
| File Type | Strategy |
|---|---|
package.json, plugin.json |
Merge objects/arrays, take higher versions |
| YAML config | Merge keys from both sides |
CHANGELOG.md |
Include entries from both sides in chronological order |
README.md, docs |
Include content from both sides |
| Source code | Integrate both changes preserving logic of each |
Lock files (bun.lock, package-lock.json) |
Delete and regenerate after resolving other files |
.release-please-manifest.json |
Take higher version numbers |
- Edit the file to remove ALL conflict markers (
<<<<<<<,|||||||,=======,>>>>>>>) and combine changes - Stage:
git add <file>
Important ours/theirs note for rebases: During git rebase, the meaning of ours/theirs is swapped — `--our
Установить git-conflicts в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Bash(git status *)Bash(git diff *)Bash(git log *)Bash(git show *)Bash(git add *)Bash(git commit *)Bash(git push *)Bash(git merge *)Bash(git checkout *)Bash(git rebase *)Bash(git restore *)Bash(git config *)Bash(git rerere *)Bash(gh pr *)ReadEditGrepGlobTodoWriteВложенные файлы
FAQ
Что делает скилл git-conflicts?
Resolve merge conflicts file-by-file. Use when a merge/rebase has conflicts, a PR can't merge, "fix conflicts" is requested, or branches have diverged.
Как установить скилл git-conflicts?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл git-conflicts запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set 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…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic