Tinker Git

by Samy (Kondasamy Jayaraman) · drawn with Colorfigures by April Zhu

Shelf split from main before the hinge change.6 commits · on main

Chapter 6 of 7

Rewriting history

Tom’s shelf branch started before main moved on. He’d like his work to sit on top of today’s main, in one straight line.

This chapter: What does a rebase do to commits, and when is it unsafe?

About this chapter

You will learn

  • A rebase replays each commit on a new parent
  • New parents mean new names
  • Never rebase commits others have

Words you’ll meet

Rebase
Moving a branch’s commits onto another commit by replaying each one, making new commits.
Replay
Applying one commit’s change again on top of a different parent.

Step 1 of 4

A would move Tom’s shelf work on top of today’s main, as if he started it now.

Predict what happens to his crates.

After the rebase, do Tom’s 2 commits keep their names?