/dev-flow:rebase-resolverfrom dev-flow
Resolve git rebase conflicts one block at a time with verification. Use when rebasing, resolving merge conflicts, or continuing a rebase. Works with git rerere. Always keeps HEAD by default, verifies with grep, never uses bulk operations. Delegates file edits to subagents.
Ships in dev-flow. 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 git rebase conflicts systematically, one block at a time, with full verification. Delegates individual file resolution to subagents for reduced context usage.
# 1. Find conflicted files
git status --porcelain | grep "^UU\|^AA\|^DD"
# 2. For each file, spawn a subagent (see Subagent Delegation below)
# 3. After all files resolved, continue rebase
git rebase --continue
git checkout --ours/--theirs, no loops, no multi-file commands<<<<<<< to >>>>>>> block independentlygit add FORBIDDEN until grep confirms 0 markersWhen a conflict spans the entire file, use git show :2: to extract HEAD directly.
This avoids token-expensive Edit operations on large files.
# Whole-file = first line is <<<<<<<, last line is >>>>>>>, exactly 3 markers
first=$(head -1 {FILE} | grep -c "^<<<<<<<")
last=$(tail -1 {FILE} | grep -c "^>>>>>>>")
markers=$(grep -c "^<<<<<<\|^======\|^>>>>>>" {FILE})
[ "$first" -eq 1 ] && [ "$last" -eq 1 ] && [ "$markers" -eq 3 ] && echo "whole-file"
# Stage 2 = HEAD version during rebase
git show :2:{FILE} > {FILE}
git add {FILE}
Benefits: Zero tokens for resolution. Works for any file size.
For files with partial conflicts (not whole-file), spawn a general-purpose subagent.
Resolve git conflicts in: {FILE_PATH}
RESOLUTION STRATEGY: Always keep HEAD version (between <<<<<<< HEAD and =======)
WORKFLOW:
1. Run: grep -n "^<<<<<<\|^======\|^>>>>>>" {FILE_PATH}
2. Read the file around each conflict
3. For EACH conflict block (top to bottom):
- Use Edit tool with old_string = ENTIRE block from <<<<<<< HEAD through >>>>>>> commit
- new_string = HEAD content only (no markers)
4. After ALL conflicts resolved, verify: grep -c "^<<<<<<\|^======\|^>>>>>>" {FILE_PATH} || echo "0 markers"
5. If 0 markers, stage: git add {FILE_PATH}
6. Report: "Resolved {N} conflicts in {FILE_PATH}, staged successfully" or any errors
RULES:
- One conflict at a time, top to bottom
- Never use bulk operations (no git checkout --ours/--theirs)
- Include FULL block in Edit (all 3 markers + content) to avoid orphans
- Do NOT continue rebase - just resolve and stage this file
Identify conflicts:
git status --porcelain | grep "^UU\|^AA\|^DD"
For each file, detect whole-file vs partial:
first=$(head -1 {FILE} | grep -c "^<<<<<<<")
last=$(tail -1 {FILE} | grep -c "^>>>>>>>")
markers=$(grep -c "^<<<<<<\|^======\|^>>>>>>" {FILE})
[ "$first" -eq 1 ] && [ "$last" -eq 1 ] && [ "$markers" -eq 3 ] && echo "whole-file"
If whole-file: Resolve directly (no subagent):
git show :2:{FILE} > {FILE}
git add {FILE}
If partial conflicts: Spawn subagent:
Task tool:
subagent_type: general-purpose
prompt: [use template above with actual file path]
description: "Resolve conflicts in {filename}"
Parallel execution: Run whole-file resolutions in parallel with Bash. Spawn subagents in parallel for partial conflicts.
After all complete, verify overall status:
git status --porcelain | grep "^UU\|^AA\|^DD" || echo "All resolved"
Continue rebase:
git rebase --continue
For AA conflicts where both versions added the same file:
Ensure rerere is enabled (remembers resolutions for reuse):
git config --get rerere.enabled # Check status
git config --global rerere.enabled true # Enable if needed
See references/rerere.md for detailed documentation.
If needed, resolve directly following these steps:
grep -n "^<<<<<<\|^======\|^>>>>>>" <file>
Process markers one at a time, top to bottom.
2a. Read: Use Read tool with offset/limit around conflict lines
2b. Conflict structure:
<<<<<<< HEAD
(HEAD version - current branch)
=======
(Incoming version - commit being rebased)
>>>>>>> commit-hash
2c. Edit: Use Edit tool — CRITICAL: include FULL block
old_string: ENTIRE conflict from <<<<<<< HEAD through >>>>>>> commit
(all three markers AND all content between them)
new_string: resolved content only (no markers)
WARNING: Partial edits leave orphaned content without markers. Always include the complete block from opening marker to closing marker in a single Edit operation.
2d. Repeat for each conflict in file
grep -c "^<<<<<<\|^======\|^>>>>>>" <file> || echo "0 markers"
STOP if not 0. Do NOT proceed to staging.
git add <file>
old_string: Full block from <<<<<<< HEAD through >>>>>>> commit
new_string: Only HEAD content (between <<<<<<< HEAD and =======)
old_string: Full block from <<<<<<< HEAD through >>>>>>> commit
new_string: Only incoming content (between ======= and >>>>>>>)
Combine both versions, remove all markers.
references/rerere.md — Git rerere documentationreferences/troubleshooting.md — Common issues and fixesWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub full-stack-biz/claude-dev-flow --plugin dev-flow4 skills in this plugin
/git-flowInitialize git-flow, manage feature/release/hotfix branches, and coordinate multi-component releases. Use when setting up branching strategy, starting/finishing branches, or releasing with semantic versioning. Integrates with release-process skill./git-flow-nextManage git-flow branching workflows. Use when working with feature branches, release branches, hotfixes, or configuring branching strategy. Supports Classic GitFlow, GitHub Flow, GitLab Flow, and custom configurations./release-processPlan and execute releases with semantic versioning and bracket-based freezing. Use when: "how do I release", "bump the version", "write the changelog", "what version comes next", "release the plugin", or managing scope creep in monorepos. Prevents version thrashing; supports single projects, monorepos, and multi-component systems.