Skip to content
Download

Interactive rebase

An interactive rebase replays your branch's commits onto another commit, and lets you choose what happens to each one: keep, reword, edit, squash, fold or drop it.
Commitline checks every step before you start, so you see a conflict coming.

Start a rebase

  • In History, choose the commit to rebase onto, then Rebase onto here in the Commit view.
  • Or drag your branch's chip onto another branch's chip and choose Rebase … onto …; see Merge, cherry-pick and revert.

The Rebase screen opens, such as Rebase 5 commits of feature onto main, with your commits in order.
Commit or stash your changes first: a rebase doesn't start with uncommitted changes.

Choose what happens to each commit

ActionKeyWhat it does
PickPKeeps the commit as it is.
RewordRKeeps it, with a new message you type.
EditEStops after it, so you can change it.
SquashSFolds it into the commit before it, with a new message you type.
FixupFFolds it into the commit before it, keeping that one's message.
DropDLeaves it out.

To change the order, drag a row, or press Alt+↑ and Alt+↓. ↑ and ↓ move between rows.

See conflicts before you start

The Check column tests each step against the ones before it, without touching your files:

  • Applies cleanly;
  • Folds into a commit, for a squash or fixup;
  • Conflicts in the files that would conflict;
  • Left out, for a dropped commit.

While you drag a row, its check shows what would happen at that spot.
For a step that would conflict, Commitline suggests where moving it clears the conflict.

The Rebase preview view, on the right, shows your branch now and after the rebase.
When a step will stop on a conflict, it says which files and why, so you can move or drop that commit, or resolve it when the rebase stops there.

The Rebase screen for two commits of main onto fix/seed-names, each with a conflict warning, beside the Rebase preview: Step 1 will stop on a conflictThe Rebase screen for two commits of main onto fix/seed-names, each with a conflict warning, beside the Rebase preview: Step 1 will stop on a conflict

The Check column needs Git 2.45 or later; with an older Git it says Not checked on this git.

Options

  • Move stacked branches with it: when other branches of yours are built on these commits, they move too.
    It names them.
  • Fold fixup! commits into their targets: commits whose message starts with fixup! fold into the commit they name.
  • Undo puts the branch back as it was, once the rebase finishes: always on.

Run it

Choose Start rebase.
Cancel closes the screen and changes nothing.

When the rebase stops

The rebase stops at an Edit step, and on a conflict.
The Git view then says Rebasing, with:

  • Continue, which goes on to the next step.
    After an Edit stop, it first commits what you changed;
  • Skip, where Git allows it, which leaves out the step it stopped on;
  • Abort rebase, which puts your branch back as it was before the rebase.

At an Edit stop, change your files, stage them, and choose Continue.
On a conflict, choose Resolve conflicts, resolve each file, then Continue the rebase; see Resolve conflicts.

After the rebase

  • Ctrl+Z (⌘Z on a Mac) puts your branch back as it was, and the stacked branches that moved with it.
    See Undo.
  • If you had already pushed the branch, a push is now refused, and Commitline offers a force push with lease.
    See Fetch, pull and push.

Merge commits on the branch aren't replayed, and a rebase takes up to 500 commits.