Resolve merge conflicts with main branch
Automates resolving git merge conflicts with main branch. Fetches updates, identifies conflicted files, guides you through resolution strategies, runs tests, and pushes the fixed branch.
/plugin marketplace add ken2403/.claude-paralell-dev-plugin/plugin install pw@claude-parallel-dev-pluginbranch nameopus$ARGUMENTS
git branch --show-currentgit rev-list --count HEAD..origin/main 2>/dev/null || echo "unknown"echo "=== Current Status ==="
git status 2>/dev/null || echo "Not in git repo"
git fetch origin main
git merge origin/main
echo "=== Conflicting Files ==="
git status | grep "both modified" || echo "No conflicts or not in merge state"
For each conflicted file:
Use explorer subagent if context is needed:
Use explorer subagent to understand the purpose of conflicting code
For each conflicted file:
# After editing to resolve
git add [file]
git commit -m "$(cat <<'EOF'
merge: resolve conflicts with main
Resolved conflicts in:
- [file1]
- [file2]
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
# Run project checks
if [ -f "Makefile" ] && grep -q "check" Makefile; then
make check
elif [ -f "package.json" ]; then
npm test 2>/dev/null || true
elif [ -f "pyproject.toml" ]; then
uv run pytest 2>/dev/null || true
fi
git push
When our changes are correct and theirs should be discarded.
When main branch changes should take precedence.
When both changes are needed and can coexist.
When neither version is correct and new code is needed.
# Conflict Resolution Report
## Files Resolved
| File | Strategy | Notes |
|------|----------|-------|
| [file1] | Combined | Merged both changes |
| [file2] | Keep ours | Our logic was correct |
## Verification
- [ ] Merge completed
- [ ] Tests pass
- [ ] Code compiles/runs
- [ ] Changes pushed
## Commit
- SHA: [commit-sha]
- Message: merge: resolve conflicts with main
## Next Steps
PR is now mergeable. Run `/pw:merge [pr-number]`
If resolution is too complex:
git merge --abort
git reset --hard HEAD
git clean -fd