Skip to content
Versora

Manual

Hygiene and workflow

Bulk rebase

6 min read

On this page

When main moves on, the working branches fall behind. Updating them one by one means checking out, rebasing, resolving conflicts and going back, several times. Versora's bulk rebase rebuilds all the chosen branches on the tip of the base at once, without a checkout and without touching your files. Before starting, it shows a plan with each branch's outcome, including the exact conflict that would stop any of them. The ones that would conflict are left out; the others go together, in a single operation.

Plan and run the bulk rebase

Where to find it

Everything starts from the Branches review:

  • Rebase outdated (N)… button at the top of the screen (all local branches behind the base);
  • the "N local branches are behind main and can be updated with a rebase." bar › Plan the rebase…;
  • bar of checked branches › Rebase N branches onto main…;
  • right-click a row › Rebase N branches onto main…;
  • the R key with branches checked (or on the current row).

Palette (Ctrl+P): "Rebase outdated branches…" opens the review already filtered to the local branches behind the base ("The local branches behind the base, to plan a bulk rebase").

Step by step

  1. Open the Branches review and check the Base (for example origin/main). The branches will be rebuilt on its tip.
  2. Click Rebase outdated (N)… or check the branches and use Rebase N branches onto main….
  3. The Bulk rebase onto main window shows "Planning and predicting conflicts…" and then the plan. The introduction sums up the rule: "Each branch is rebuilt in memory on the tip of main, with no checkout and without touching your files; stacked branches go together, in stack order. The ones that would conflict are left out. It's all a single operation: Ctrl+Z restores every branch."
  4. Read each row (table below). Uncheck what you don't want to rebuild now.
  5. Click Rebase N branches (or Ctrl+Enter). The bar shows "Rebasing N branches…".
  6. The final summary says "Rebased 4 branches", how many commits were reapplied ("18 commits") and how many empty commits were dropped ("2 empty dropped"). The branches that were already on the remote show up with the force push warning.

What each row of the plan says

RowMeaning
"4 commits onto main (12 behind)"The branch is ready: 4 of its commits will be reapplied on top of the base, which has 12 commits it didn't have.
"6 commits in 3 branches, through the stack"The branch belongs to a stack: it and the ones above go together, in stack order (stack badge).
"Left out: feature/x would conflict at commit a1b2c3d4 "adjust filters" (src/a.ts). Rebase it by hand to resolve it in the conflict editor."The plan found the exact conflict. That branch isn't touched.
"Already up to date with main." / "The stack is already up to date."Nothing to do.
"All its content is already in main: it's a cleanup case, not a rebase."The branch is already merged. Use Branch cleanup.
"2 commits are already in the base and are dropped (like git rebase does)."Commits that became empty because the same content is already in the base.
"Already pushed (feature/login): after the rebase, the push will need to be forced."The branch exists on the remote; its history will change.
current badgeIt's the checked-out branch. It's included if it has no uncommitted changes, and the working directory follows along.

The footer shows "N with nothing to do" and "N branches chosen".

What's left out of the bulk rebase

MessageWhat to do
"main is a main branch and isn't part of the bulk rebase."Main branches are never rebuilt here.
"feature/x is in use in the worktree C:\…: rebase it from there."Open the worktree and rebase it there.
"feature/x is the current branch and has uncommitted changes."Commit or stash first.
"It has merge commits (…): use the interactive rebase."Branches with merge commits need the interactive rebase.
"No history in common with the base (…)."The branch has no relation to the base.
"Too many commits for the bulk rebase (…)."There's a cap of 3,000 commits reapplied at a time. Choose fewer branches.
"feature/x no longer exists."The branch was deleted after the list was read.
"A rebase is in progress: finish or abort it before the bulk rebase."Finish or abort the operation stopped in the repository.

A plan has at most 60 branches. When more are requested, the window warns: "This plan covers the 60 most recent of the 85 requested. The rest go in the next batch (the rebased ones drop out)." Rebase this batch and open the plan again for the next one.

What Versora does in git

Each commit is reapplied in memory, without a checkout, with the same engine used to drag commits in the graph. The plan's conflict prediction is exactly the same computation the run does:

bash
# for each commit on the branch, in order
git merge-tree --write-tree --merge-base <original-parent> <new-base> <commit>
git commit-tree <tree> -p <new-parent>   # same message, author and author date as the original

At the end, a single transaction moves all the branches at once, checking that each one is still on the planned commit. Either they all change, or none does:

bash
git update-ref --stdin   # update refs/heads/feature/x <new> <old> …

Each branch's reflog records "rebase (Versora): onto". If the current branch was part of the rebase, the working directory follows along with git reset --keep, which refuses if anything would be lost.

Requires git 2.40 or newer.

How to undo

Ctrl+Z puts all the branches back at once, on the commit they were on. The final summary also has Undo: "Ctrl+Z (or the button below) restores every branch at once." In the timeline, the entry appears as "Rebase of 4 branches onto main".

Undo doesn't reach the server: if you've already force pushed a branch, undoing here only changes your local copy.

Caveats and messages

  • "feature/login was already on the remote: the next push needs to be forced (the app uses --force-with-lease).": the rebase rewrote a published branch. See Force push.
  • "main changed since the plan. Plan again.": the base moved (for example, because of a fetch) between the plan and the run.
  • "feature/x changed since the plan and was left out. Plan again.": the branch got commits after the plan.
  • "feature/x would conflict at commit a1b2c3d4 (2 files) and was left as it was.": the conflict only showed up during the run; the branch wasn't touched.
  • "No branch was moved: …": the final transaction failed and nothing changed.
  • "feature/x is the current branch and changed during the bulk rebase; it was left as it was." and "The current branch feature/x wasn't updated: …": the current branch couldn't follow along; the others go ahead.
  • "Bulk rebase needs git 2.40 or newer (installed: …).": update git. See Git version.
  • "None of the selected branches is a local branch behind main.": the R key or the action was used without an eligible branch checked.
  • "The active tab changed: go back to the repository to rebase.": the plan belongs to the tab it was opened in.
  • "The bulk rebase didn't run. See the error notice.": the run failed before starting.

Tip

For the branches left out because of a conflict, rebase them one at a time from the branch menu. The conflict opens in the usual conflict editor.

  • The base comes from the Branches review (remembered per repository).
  • The protected branches are the ones in Preferences › Checks, plus the server's, the team's (.versora.yml) and the company's (protected_branches). See Policy keys.

See also