18. Rebase replays your commits on a new base
Rebase cherry-picks each of your commits onto the new tip and moves your note; the old commits remain unreferenced; the files match a merge but the history is a line.

18. Rebase replays your commits on a new base

Rebase cherry-picks each of your commits onto the new tip and moves your note; the old commits remain unreferenced; the files match a merge but the history is a line.

It demystifies the most feared command by reducing it to two ideas already learned.

Your branch started from an old commit on main. Main has moved on.

Rebase moves your work to start from the new tip. It cherry picks your commits, one by one, onto it.

Then it moves your branch note to the last copy.

The copies have new names. The originals are still there, with no note. Same rule as always.

Merge and rebase end with the same files. The difference is the shape of the history. Rebase makes it a straight line.

Check yourself. After a rebase, are the commit names on your branch the same as before?

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Connections0

Connections show where other documents or comments link to this document.

Related documents

Loading connections…