/resolve-merge-conflicts
Resolve git merge conflicts with intelligent context analysis
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/resolve-merge-conflicts
Context preview
What this command does when you run it.
Resolve git merge conflicts with intelligent context analysis
Command definition
resolve-merge-conflicts.mdallowed-tools: Bash(git status:*), Bash(git show:*), Bash(git log:*), Bash(git diff:*), Bash(git merge:*), Bash(git add:*), Bash(git commit:*), Bash(rg:*), Bash(fd:*), Read, Write, Edit
name: "Resolve Merge Conflicts"
description: "Resolve git merge conflicts with intelligent context analysis"
author: "wcygan"
tags: ["git"]
version: "1.0.0"
created_at: "2025-07-14T00:00:00Z"
updated_at: "2025-07-14T00:00:00Z"
Context
- Session ID: !`gdate +%s%N`
- Current git status: !`git status --porcelain`
- Current branch: !`git branch --show-current`
- Merge head info: !`git show --oneline --no-patch MERGE_HEAD 2>/dev/null || echo "No active merge"`
- Conflicted files: !`git diff --name-only --diff-filter=U 2>/dev/null || echo "No conflicts"`
- Recent commits on current branch: !`git log --oneline -5`
- Incoming commits: !`git log --oneline HEAD..MERGE_HEAD 2>/dev/null || echo "No merge in progress"`
Your Task
Resolve git merge conflicts by analyzing the context of incoming commits and current branch changes.
**STEP 1: Validate Merge Conflict State**
IF no merge conflicts detected:
- PRINT "No active merge conflicts found"
- SUGGEST checking if user needs to start a merge operation
- EXIT with guidance
IF merge conflicts found:
- CONTINUE to conflict analysis
**STEP 2: Comprehensive Conflict Analysis with Parallel Investigation**
Think deeply about the optimal conflict resolution strategy based on merge complexity and file types involved.
FOR complex merges (>5 conflicted files OR complex semantic conflicts):
**CRITICAL: Deploy parallel sub-agents for comprehensive conflict analysis (7-9x faster resolution planning)**
IMMEDIATELY launch 6 specialized conflict analysis agents:
- **Agent 1: Structural Conflict Analysis**: Analyze code structure and architectural conflicts
- Focus: Class definitions, function signatures, import statements, module organization
- Tools: AST analysis, structural diff comparison, dependency impact assessment
- Output: Structural resolution strategy with refactoring recommendations
- **Agent 2: Semantic Conflict Analysis**: Examine logical conflicts and business rule changes
- Focus: Business logic differences, algorithm changes, behavioral modifications
- Tools: Semantic analysis, test impact assessment, behavior comparison
- Output: Semantic resolution approach with integration testing requirements
- **Agent 3: Data Flow Conflict Analysis**: Investigate data handling and transformation conflicts
- Focus: Variable assignments, data transformations, API contracts, database changes
- Tools: Data flow analysis, contract validation, schema compatibility checking
- Output: Data flow resolution with migration and compatibility strategies
- **Agent 4: Configuration Conflict Analysis**: Resolve environment and configuration conflicts
- Focus: Config files, environment variables, build settings, deployment configurations
- Tools: Configuration comparison, environment analysis, dependency resolution
- Output: Configuration merge strategy with environment-specific considerations
- **Agent 5: Test Conflict Analysis**: Analyze test code conflicts and coverage impact
- Focus: Test modifications, mock updates, assertion changes, test data conflicts
- Tools: Test analysis, coverage impact assessment, test strategy evaluation
- Output: Test resolution plan with coverage maintenance and quality assurance
- **Agent 6: Documentation Conflict Analysis**: Resolve documentation and comment conflicts
- Focus: README changes, API documentation, inline comments, architectural documentation
- Tools: Documentation analysis, consistency checking, information architecture review
- Output: Documentation merge strategy with consistency and completeness validation
**Sub-Agent Coordination:**
- Each agent saves findings to `/tmp/merge-conflict-agents-$SESSION_ID/`
- Parallel analysis provides 7-9x speed improvement over sequential conflict resolution
- Cross-agent correlation identifies interdependent conflicts requiring coordinated resolution
- Results synthesized into comprehensive resolution plan with risk assessment and rollback procedures
FOR simple merges (≤5 files with straightforward conflicts):
Execute sequential conflict analysis:
FOR EACH conflicted file:
1. **Read the conflicted file** to understand conflict markers 2. **Analyze incoming changes** from MERGE_HEAD commits 3. **Analyze current branch changes** since common ancestor 4. **Identify conflict patterns**:
- Simple text conflicts (different lines)
- Structural conflicts (function signatures, imports)
- Semantic conflicts (logic changes)
- Formatting conflicts (whitespace, style)
**STEP 3: Categorize Conflicts by Resolution Strategy**
**Automatic Resolution Candidates:**
- Formatting-only conflicts (whitespace, indentation)
- Import/dependency ordering conflicts
- Non-overlapping function additions
- Comment-only changes
**Manual Resolution Required:**
- Logic conflicts in same function
- Conflicting variable names or types
- Architectural changes
- Security-sensitive modifications
**STEP 4: Generate Resolution Plan**
CREATE resolution plan with:
1. **File-by-file analysis** showing:
- Nature of conflicts
- Recommended resolution approach
- Code context around conflicts
- Explanation of incoming vs current changes
2. **Safety checks**:
- Identify potentially breaking changes
- Flag security-sensitive modifications
- Highlight test file conflicts
3. **Resolution order**:
- Prioritize simple conflicts first
- Group related files together
- Handle complex conflicts last
**STEP 5: Interactive Resolution Process**
FOR EACH conflicted file:
**Simple Conflicts (Auto-resolvable):**
# Show the conflict
echo "=== Conflict in $file ==="
git show :1:$file # Common ancestor
git show :2:$file # Current branch (HEAD)
git show :3:$file # Incoming branch (MERGE_HEAD)
# Apply automatic resolution if safe
# Add res
Read more
allowed-tools: Bash(git status:*), Bash(git show:*), Bash(git log:*), Bash(git diff:*), Bash(git merge:*), Bash(git add:*), Bash(git commit:*), Bash(rg:*), Bash(fd:*), Read, Write, Edit name: "Resolve Merge Conflicts" description: "Resolve git merge conflicts with intelligent context analysis" author: "wcygan" tags: ["git"] version: "1.0.0" created_at: "2025-07-14T00:00:00Z" updated_at: "2025-07-14T00:00:00Z"
Context
- Session ID: !`gdate +%s%N`
- Current git status: !`git status --porcelain`
- Current branch: !`git branch --show-current`
- Merge head info: !`git show --oneline --no-patch MERGE_HEAD 2>/dev/null || echo "No active merge"`
- Conflicted files: !`git diff --name-only --diff-filter=U 2>/dev/null || echo "No conflicts"`
- Recent commits on current branch: !`git log --oneline -5`
- Incoming commits: !`git log --oneline HEAD..MERGE_HEAD 2>/dev/null || echo "No merge in progress"`
Your Task
Resolve git merge conflicts by analyzing the context of incoming commits and current branch changes.
**STEP 1: Validate Merge Conflict State**
IF no merge conflicts detected:
- PRINT "No active merge conflicts found"
- SUGGEST checking if user needs to start a merge operation
- EXIT with guidance
IF merge conflicts found:
- CONTINUE to conflict analysis
**STEP 2: Comprehensive Conflict Analysis with Parallel Investigation**
Think deeply about the optimal conflict resolution strategy based on merge complexity and file types involved.
FOR complex merges (>5 conflicted files OR complex semantic conflicts):
**CRITICAL: Deploy parallel sub-agents for comprehensive conflict analysis (7-9x faster resolution planning)**
IMMEDIATELY launch 6 specialized conflict analysis agents:
- **Agent 1: Structural Conflict Analysis**: Analyze code structure and architectural conflicts
- Focus: Class definitions, function signatures, import statements, module organization
- Tools: AST analysis, structural diff comparison, dependency impact assessment
- Output: Structural resolution strategy with refactoring recommendations
- **Agent 2: Semantic Conflict Analysis**: Examine logical conflicts and business rule changes
- Focus: Business logic differences, algorithm changes, behavioral modifications
- Tools: Semantic analysis, test impact assessment, behavior comparison
- Output: Semantic resolution approach with integration testing requirements
- **Agent 3: Data Flow Conflict Analysis**: Investigate data handling and transformation conflicts
- Focus: Variable assignments, data transformations, API contracts, database changes
- Tools: Data flow analysis, contract validation, schema compatibility checking
- Output: Data flow resolution with migration and compatibility strategies
- **Agent 4: Configuration Conflict Analysis**: Resolve environment and configuration conflicts
- Focus: Config files, environment variables, build settings, deployment configurations
- Tools: Configuration comparison, environment analysis, dependency resolution
- Output: Configuration merge strategy with environment-specific considerations
- **Agent 5: Test Conflict Analysis**: Analyze test code conflicts and coverage impact
- Focus: Test modifications, mock updates, assertion changes, test data conflicts
- Tools: Test analysis, coverage impact assessment, test strategy evaluation
- Output: Test resolution plan with coverage maintenance and quality assurance
- **Agent 6: Documentation Conflict Analysis**: Resolve documentation and comment conflicts
- Focus: README changes, API documentation, inline comments, architectural documentation
- Tools: Documentation analysis, consistency checking, information architecture review
- Output: Documentation merge strategy with consistency and completeness validation
**Sub-Agent Coordination:**
- Each agent saves findings to `/tmp/merge-conflict-agents-$SESSION_ID/`
- Parallel analysis provides 7-9x speed improvement over sequential conflict resolution
- Cross-agent correlation identifies interdependent conflicts requiring coordinated resolution
- Results synthesized into comprehensive resolution plan with risk assessment and rollback procedures
FOR simple merges (≤5 files with straightforward conflicts):
Execute sequential conflict analysis:
FOR EACH conflicted file:
1. **Read the conflicted file** to understand conflict markers 2. **Analyze incoming changes** from MERGE_HEAD commits 3. **Analyze current branch changes** since common ancestor 4. **Identify conflict patterns**:
- Simple text conflicts (different lines)
- Structural conflicts (function signatures, imports)
- Semantic conflicts (logic changes)
- Formatting conflicts (whitespace, style)
**STEP 3: Categorize Conflicts by Resolution Strategy**
**Automatic Resolution Candidates:**
- Formatting-only conflicts (whitespace, indentation)
- Import/dependency ordering conflicts
- Non-overlapping function additions
- Comment-only changes
**Manual Resolution Required:**
- Logic conflicts in same function
- Conflicting variable names or types
- Architectural changes
- Security-sensitive modifications
**STEP 4: Generate Resolution Plan**
CREATE resolution plan with:
1. **File-by-file analysis** showing:
- Nature of conflicts
- Recommended resolution approach
- Code context around conflicts
- Explanation of incoming vs current changes
2. **Safety checks**:
- Identify potentially breaking changes
- Flag security-sensitive modifications
- Highlight test file conflicts
3. **Resolution order**:
- Prioritize simple conflicts first
- Group related files together
- Handle complex conflicts last
**STEP 5: Interactive Resolution Process**
FOR EACH conflicted file:
**Simple Conflicts (Auto-resolvable):**
# Show the conflict echo "=== Conflict in $file ===" git show :1:$file # Common ancestor git show :2:$file # Current branch (HEAD) git show :3:$file # Incoming branch (MERGE_HEAD) # Apply automatic resolution if safe # Add res
A lightweight (~46kB) and comprehensive CLI tool for managing Claude commands, configurations, and workflows.
Repo: kiliczsh/claude-cmd
Other commands on claude-cmd.
- /agent-browser-automation
Automate browser interactions for development testing using Puppeteer MCP
Open command - /agent-prep-merge
Prepare branches for merging across multiple worktrees and coordinate integration
Open command - /agent-persona-accessibility-expert
Transform into accessibility expert for WCAG compliance and inclusive design
Open command - /agent-persona-api-designer
Transform into an API design specialist who creates well-structured, developer-friendly APIs
Open command - /agent-persona-backend-specialist
Transform into backend specialist for scalable API and system design
Open command - /agent-persona-cloud-architect
Cloud architect persona for designing scalable, secure cloud infrastructure using modern cloud-native technologies
Open command

