From git-plugin
Resolves Git merge and rebase conflicts file-by-file using modern tooling. Activates for conflicted merges, rebases, PRs unable to merge, or diverged branches. Supports --ours, --theirs, auto-push.
npx claudepluginhub laurigates/claude-plugins --plugin git-pluginThis skill is limited to using the following tools:
Resolve merge conflicts using modern git features.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
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 merge.conflictStylegit config 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 merge origin/<base-branch>git 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--push flag: git push origin $(git branch --show-current)Summarize what was resolved:
gh pr comment <number> --body "Merge conflicts resolved."||||||| section) to understand what both sides changedIf the same conflicts keep recurring, the likely cause is squash merges. Squash-merging breaks the common ancestry chain, so stacked or sibling branches lose their merge base. Rerere mitigates this by replaying recorded resolutions, but the root fix is to avoid squash merges on branches with dependents.
Abort with git merge --abort or git rebase --abort if:
| 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 |