Git Rebase Workflow
Trigger Boundary
- •Use only when local feature branch history needs cleanup before PR creation.
- •Do not use once a PR is open; use
git-pr-sync-workflow. - •Do not use on shared protected branches.
Goal
Keep local branch history coherent and review-ready without losing change intent.
Shared Git Contract (Canonical)
- •Use
../git-branch-strategy/references/git-governance-contract.mdas the single schema and gate source. - •Track rebase artifacts with
GIT-RBS-*IDs. - •Run machine validation:
python3 ../git-branch-strategy/scripts/validate_git_contract.py --manifest <path/to/manifest.json>.
Inputs
- •Current branch divergence from target base branch
- •Team policy for force-push and rewritten history
- •PR status and branch sharing status
Outputs
- •
GIT-RBS-*rebased branch execution record - •Conflict resolution notes for rewritten commits
- •Push plan aligned with rewrite policy
Workflow
- •Verify the branch is unshared and
checks.pr_opened=false. - •Fetch latest target branch and inspect divergence.
- •Rebase feature commits onto target base in logical order.
- •Resolve conflicts commit-by-commit with behavioral verification.
- •Run tests, then push with approved force-with-lease policy.
Quality Gates
- •Rebased commits preserve original behavioral intent.
- •Conflict resolutions are verified with tests.
- •
checks.pr_opened=falseandchecks.rebase_used=trueare satisfied. - •History rewrite complies with team policy and branch protections.
Failure Handling
- •Stop when a PR is already open for the branch.
- •Stop when rebase would rewrite shared protected history.
- •Escalate when rewrite policy exceptions are requested.