| name | rebase |
| description | Rebase the current branch onto its base branch, resolve all conflicts, and verify lint, i18n, and build pass. Use when the user asks to rebase, update, or sync a branch with its upstream base. |
Rebase
Rebase the current branch onto its base branch.
Step 1 — Determine the base branch
Read release-branches.md to get the list of
branches. For each branch, compute the merge-base with HEAD and count the
commits between them:
mb=$(git merge-base HEAD <branch>)
git rev-list --count "$mb"..HEAD
The base branch is whichever has the lowest commit count (fewest commits
between the merge-base and HEAD). If counts are tied, prefer main.
Tell the user which base branch was detected before proceeding.
Step 2 — Check if base branch is up to date
Run git fetch upstream <base-branch> to update the remote tracking ref (this
is read-only and does not change any local branches), then compare:
git fetch upstream <base-branch>
git rev-list --count <base-branch>..upstream/<base-branch>
If the count is 0, the local base branch is up to date — skip ahead to
Step 3.
If the count is greater than 0, tell the user how many commits their local
base branch is behind the remote and ask whether they want to pull. Do NOT
pull without the user's consent.
- If the user says yes, run
git checkout <base-branch> && git merge --ff-only upstream/<base-branch> && git checkout - then continue to Step 3.
- If the user says no (or to skip), continue to Step 3 using the local
base branch as-is.