Git Rebase: Understand Commit Replay
A new base, not a moved commit
Imagine you add watering and light notes on a private feature branch while main gains a README. Rebase takes the applicable changes from your feature commits and replays them on the newer main. Each resulting commit has a new parent and normally a new ID. The original objects are not edited in place. The main reference does not advance merely because feature is rebased.
Read the graph first
Before: A--B--C (main), with A--D--E (feature). After rebasing feature: A--B--C--D′--E′ (feature); main still points to C. A rescue branch can still point to E. The common ancestor before replay is A. In this example D′ has parent C and E′ has parent D′. An already integrated or equivalent patch may be omitted; not every rebase produces the same number of commits.
Identity and dates
A commit identifies its tree, parents and metadata. Replayed commits normally retain author information and author date but get a new committer date; options can change these defaults. Even with identical file content, a different parent changes the ID. Compare snapshots and patch series separately.
Practice
In the chapter lab report, locate the old tip, new tip and author-date assertions. Draw the parent arrows and explain why a rescue reference can still reach old commits. The automated lab is disposable; do not run the examples in a shared branch.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Git Rebase: Understand Commit Replay — knowledge check
Reason about safe rebase and history integration.
What changes when a commit is replayed onto a different parent?
Which reference stays fixed when rebasing feature onto main in this lab?
Why may a replay omit a commit?
What usually happens to author date during ordinary replay?
What preserves the original feature tip?