Skip to content
Rewriting

Rebasing

New commits with the same changes, on a different base.

A rebase does not move commits. It takes the change each one made, applies it to a new base, and records a new commit — with the same author and message but a different parent, and therefore a different id.

The originals stay in the object store, unreferenced, until a garbage collection. That is why a rebase that goes wrong is recoverable.

Each replay is a three-way merge, which is why a rebase can conflict once per commit, and why the conflict looks exactly like a merge conflict when it does.

Commands in this lesson

git rebase
Replay this branch's commits onto a different base, as new commits
No account, no backend. Everything you do stays in this browser.liter8.sh