Interactive Rebase with --keep-base

Posted . Visible to the public.

Purpose:
Interactively rebase your current branch onto main, keeping the original base commit (i.e. not rebasing onto main directly).

Use Case:
Useful when you've branched off a long-lived feature branch and want to clean up your commits without changing the original base. Afterwards you will be able to rebase one clean commit interactively onto main without going through each commit individually using git rebase -i main.

What it does:

  • Opens an interactive rebase UI.
  • Keeps your branch's base intact (no rebasing onto main).
  • Lets you squash, reorder, edit, or drop commits.

Info

This is not the same as git rebase -i main, which would rebase your branch onto main, changing its base.

Example:

git rebase -i --keep-base main
Felix Eschey
Last edit
Felix Eschey
License
Source code in this card is licensed under the MIT License.
Posted by Felix Eschey to makandra dev (2025-04-14 06:52)