LESSON 01 / 3·2 min readFoundation

Merge vs rebase vs cherry-pick?

01 Understand02 Recall03 Prepare

Understand the concept

Merge, rebase and cherry-pick integrate changes through different history operations. Merge combines histories, rebase recreates commits on a new base, and cherry-pick recreates selected changes on the current branch. Recreated commits receive new IDs, which matters when other people already depend on the old history.

Important ideas

  • Merge combines branch histories without rewriting existing commits.

  • Rebase replays commits on a new base and changes their IDs.

  • Cherry-pick applies one selected commit; avoid rebasing shared history without coordination.

  • A linear history can be useful, but shared-branch coordination matters more than a visually tidy commit graph.

PAUSE & RECALL

Can you explain it without the notes?

Merge vs rebase vs cherry-pick?

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

Merge, rebase and cherry-pick integrate changes through different history operations. Merge combines histories, rebase recreates commits on a new base, and cherry-pick recreates selected changes on the current branch. Recreated commits receive new IDs, which matters when other people already depend on the old history.

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

  • Explain when preserving history is important and why rewriting shared commits can disrupt collaborators.
Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: Reset vs revert, and when should I use stash?

Adapted from 09_TESTING_GIT_DOCKER_CLOUD.md · “Merge vs rebase vs cherry-pick?”. Examples are study fragments; framework behavior can depend on your version.