Git - Support `git rebase --onto` (transplant a range of commits)
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
### Problem
VS Code can only run a plain `git rebase `, via the `Git: Rebase Branch...` command.
That form always replays every commit since the merge base.
There is no way to run the three-argument form:
```
git rebase --onto []
```
This is the standard way to move a branch that was started from the wrong base, or to
transplant a stacked branch after its parent branch was merged or rewritten. This is
typical in some projects where squashed merges are used. Today the only option is the
terminal.
### Proposal
Add a command, for example `Git: Rebase Onto...`, that asks for two refs:
1. **New base** — the commit or branch to replay onto (``).
2. **Upstream** — the commit or branch that marks where to cut (``).
The current branch is used as ``. Then run `git rebase --onto `.
It should also be available inside the Git context menu where it should inside of "Branch"
below "Rebase Branch..."
It would also be useful to reach this from the Graph view: right-click a commit or branch,
pick *Rebase Onto*, then pick the upstream in a second step.
### Notes
- #276712 adds a context menu entry for the existing plain rebase. This request is about
the separate `` argument, which is not covered there.
- This is independent of interactive rebase (#31153, #260637).
- Conflicts can reuse the existing rebase conflict flow, including *Continue* and *Abort*.
Contributor guide
Assessment
This issue has not been assessed yet.