/git-plugin:git-conflicts file path, PR number, --ours, --theirs, or --pushfrom git-plugin
Resolves merge conflicts file-by-file using modern git features. Handles merge/rebase conflicts, PR merge-blockers, and divergent branches with --ours/--theirs options.
Ships in git-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Resolve merge conflicts using modern git features.
| 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 |
git branch --show-currentgit status --porcelain=v2 --branchfind .git -maxdepth 1 -name 'MERGE_HEAD' -o -name 'REBASE_HEAD' -o -name 'rebase-merge' -o -name 'rebase-apply'git diff --name-only --diff-filter=Ugit config --default '' merge.conflictStylegit config --default '' rerere.enabledgit versionParse 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 committedExecute this conflict resolution workflow:
MERGE_HEAD, REBASE_HEAD, rebase-merge, rebase-apply)gh pr view <number> --json headRefName,baseRefName,mergeablegit fetch origin <base-branch>git rebase origin/<base-branch>. A merge commit
in a PR branch forces the PR to squash-merge (rule 4 in github-pr-title
→ merge-strategies.md), so
rebasing keeps the PR rebase-eligible.git merge origin/<base-branch> --no-ff when 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.gh pr list --head $(git branch --show-current) --json number,baseRefName,mergeablegit diff --name-only --diff-filter=UCheck the conflict style from context. If merge.conflictStyle is not zdiff3:
git config merge.conflictStyle zdiff3git checkout --conflict=zdiff3 -- <file> for each conflicted filegit config rerere.enabled truegit 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.
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:
<<<<<<< HEAD
(current branch changes)
||||||| (common ancestor)
(what the code looked like before both changes)
=======
(incoming changes)
>>>>>>> branch-name
||||||| section (common ancestor) shows what both sides started from — use it to understand intent| 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 |
<<<<<<<, |||||||, =======, >>>>>>>) and combine changesgit add <file>Important ours/theirs note for rebases: During git rebase, the meaning of ours/theirs is swapped — --ours refers to the branch being rebased onto (usually main), --theirs refers to your feature branch commits.
<<<<<<<git diff --name-only --diff-filter=U returns empty (no remaining unmerged paths)git rerere statusgit commit --no-editgit rebase --continue; a rebase stops once per conflicting commit, so repeat Steps 3–4 until it finishes--push flag: git push origin $(git branch --show-current) after a
merge, or git push --force-with-lease origin $(git branch --show-current)
after a rebaseSummarize what was resolved:
gh pr comment body: REFERENCE.md.||||||| section) to understand what both sides changedSame conflicts recurring after squash merges: cause, rerere mitigation and --onto recovery in REFERENCE.md.
Abort with git merge --abort or git rebase --abort if:
When several branches will land together, resolve their conflicts once on a throwaway trial branch with rerere on, and build and test that merged tree before touching main. Recipe: REFERENCE.md.
| Task | Command |
|---|---|
| List conflicted files | git diff --name-only --diff-filter=U |
| Re-checkout with zdiff3 | git checkout --conflict=zdiff3 -- <file> |
| Accept current branch | git restore --ours -- <file> |
| Accept incoming branch | git restore --theirs -- <file> |
| Recreate conflict markers | git checkout -m -- <file> |
| Check rerere status | git rerere status |
| View rerere diff | git rerere diff |
| Forget bad resolution | git rerere forget <file> |
| Abort merge | git merge --abort |
| Abort rebase | git rebase --abort |
| Continue rebase | git rebase --continue |
| Context | Command |
|---|---|
| List conflicts | git diff --name-only --diff-filter=U |
| Conflict count | git diff --name-only --diff-filter=U | wc -l |
| Full conflict diff | git diff --diff-filter=U |
| PR mergeable state | gh pr view N --json mergeable |
| Check markers remain | grep -rn '<<<<<<<' <files> |
| Porcelain status | git status --porcelain=v2 |
| Detect merge/rebase state | test -f .git/MERGE_HEAD && echo merge || test -d .git/rebase-merge && echo rebase |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub laurigates/claude-plugins --plugin git-plugin52 skills in this plugin
/deadbranchdeadbranch CLI for stale-branch cleanup — dry-run preview, TUI or non-interactive delete, protects main/develop/WIP. Use when asked to clean up branches, prune branches, or remove stale branches./external-pr-trustAuthorship as a precondition of merging — bot vs stranger classification, what a merge executes, the merge-guard hook. Use when bulk-merging PRs, or when a merge is denied for a non-self author./gh-cli-agenticgh CLI commands with JSON output for agents. Use when querying PRs, issues, runs, or repo metadata; inspecting PR checks; fetching failed CI logs; or mapping a github.com URL to an API call./git-api-prGitHub API PR creation without local git. Use when submitting file changes as a PR without local commits — quick fixes, typos, config updates, or bypassing local git state./git-branch-namingBranch names: type prefix (feat/, fix/, chore/), issue number, kebab-case. Use when picking a name for a new branch or setting a repo's branch-naming convention./git-branch-pr-workflowBranch management and PR workflows — git switch/restore, GitHub MCP. Use when creating branches, opening PRs, or working with feature branches.Other plugins' skills for the same job