rebase
Rebase in place
Rebase each named local branch onto one target so the branch itself moves. Resolve conflicts by intent, validate every result, report, and push only the branches the user approves.
Accept branches and a target in natural language or as /rebase fix/a feat/b --onto origin/develop. --remote names the publication remote when a branch has no upstream or an ambiguous one. --onto names the target, not Git's three-argument transplant.
1. Establish the batch
Read repository instructions. Inspect git status, git worktree list, remotes, and each branch's upstream. Resolve every input to a local branch refs/heads/<name> and, where one exists, its publication remote and full destination ref. A remote name such as origin/feature maps to its local branch; ask before creating a local branch that does not exist yet. Deduplicate, drop the target from the set, and ask about anything missing or ambiguous before changing anything.
Where a branch is checked out decides where it rebases:
| Branch location | Rebase location |
|---|---|
| Not checked out anywhere | A new linked worktree on that branch, in the host's temporary or state directory: git worktree add "$batch_dir/<name>" <name> |
| Checked out in a clean checkout with no Git operation in progress | That checkout, the current one included |
| Checked out in a checkout with uncommitted work or an operation in progress | Ask whether to commit, stash, or skip; the uncommitted work stays the user's |
Completion: every branch has one rebase location and either a publication destination or a local only mark.