Rebase Branch onto Main
Rebase the current feature branch onto origin/main and resolve conflicts.
Pre-flight Checks (Abort if any fail)
- Working directory is clean (
git statusshows no uncommitted changes) - Not already in rebase/merge state
- Not on main/master branch
- Remote origin exists
Workflow
git fetch origingit rebase origin/main- For each conflict:
- Apply resolution strategy (see below)
- Verify no conflict markers remain
git add <file>orgit rm <file>git rebase --continue
- Run code checks:
mcp__code-checker__run_pytest_check,mcp__code-checker__run_pylint_check,mcp__code-checker__run_mypy_check - Fix any issues from merge
- Report summary and ask for user confirmation
git push --force-with-lease
Conflict Resolution Strategies
| File Type | Strategy |
|---|---|
Code files (.py, .js, etc.) |
Keep both sides, merge imports |
| Test files | Keep all tests from both sides |
| Config files | Merge additively, prefer HEAD for same keys |
Lockfiles (*-lock.json, *.lock) |
Accept theirs (--theirs), notify user to regenerate after rebase |
Abort Rules (in priority order)
- Any unexpected error - abort, report full error
- Binary file conflict - abort, cannot auto-resolve
- Unknown file type - abort, no safe strategy
- Conflict markers remain after resolution - abort
- Same file conflicts 3+ times - abort
- Code quality fails after 2 fix attempts - abort
- Any other unexpected situation - abort, suggest manual intervention
On abort: run git rebase --abort, report which rule triggered, suggest next steps.