Conflict Resolution Skill
Resolve git merge conflicts intelligently, with safe fallback to user input when uncertain.
Resolution Protocol
Step 1: Identify Conflicted Files
List all files with merge conflicts:
bash
git diff --name-only --diff-filter=U
Step 2: Analyze Each Conflict
For each conflicted file:
- •Read the file with conflict markers
- •Understand what HEAD version accomplishes
- •Understand what incoming version accomplishes
- •Determine resolution strategy
Step 3: Apply Resolution Strategy
Select strategy based on conflict type:
| Conflict Type | Strategy |
|---|---|
| Additive changes | Both add different things → keep both |
| Same location, different code | Understand intent, merge logic |
| Conflicting imports | Combine import lists |
| Style conflicts | Use project lint/format to normalize |
Step 4: Resolve and Stage
After resolving:
bash
git add <resolved-file>
Step 5: Complete Merge
Finalize the merge commit:
bash
git commit --no-edit
Uncertainty Handling
Critical rule: Never guess on complex conflicts.
When uncertain about resolution:
- •Do NOT make assumptions
- •Show the conflict to user with context
- •Present options:
- •"Keep HEAD version"
- •"Keep incoming version"
- •"Manual edit needed"
- •Wait for user decision
Common Patterns
Import Conflicts
Combine import statements:
javascript
// HEAD
import { ComponentA } from './components';
// Incoming
import { ComponentB } from './components';
// Resolution
import { ComponentA, ComponentB } from './components';
Additive Function Conflicts
Keep both functions when they don't overlap:
typescript
// HEAD adds functionA // Incoming adds functionB // Resolution: keep both
Overlapping Logic
Analyze intent and merge carefully:
- •If both change the same logic differently → ask user
- •If one extends the other → keep the extension
- •If conflicting business logic → ask user
Safety Rules
- •Never delete user code without confirmation
- •Preserve all functionality from both branches when possible
- •When in doubt, ask - wrong merges are worse than slow merges
- •Test after resolution - run verification to catch merge errors
When NOT to Use This Skill
Do NOT use this skill when:
- •No actual merge conflicts exist - Only use when
git diff --name-only --diff-filter=Ureturns files - •Conflicts are in generated files - Regenerate instead of resolving (package-lock.json, yarn.lock, dist/, build/)
- •Rebasing is more appropriate - For feature branches behind main, prefer rebase over merge
- •User explicitly wants manual resolution - When user says "I'll handle this myself"
- •Binary file conflicts - Cannot merge binary files; user must choose one version
Quality Standards
- •ALWAYS verify there are actual conflicts before proceeding
- •NEVER auto-resolve conflicts involving business logic without understanding intent
- •ALWAYS run tests after resolving to catch merge errors
- •ALWAYS preserve both branches' functionality when possible
- •PRIORITIZE asking user over guessing on complex conflicts
Additional Resources
Reference Files
For detailed conflict patterns:
- •
references/conflict-patterns.md- 7 common conflict patterns with resolution strategies and auto-resolve safety ratings