Interview Prep/Git & GitHub/Merge, rebase and cherry-pick

What does `git rebase` actually do?

IntermediateConceptMerge, rebase and cherry-pick
Answer

It finds commits in your branch that are not in the new base, saves them as patches, resets the branch to the new base, and replays each patch as a brand new commit. The new commits have different IDs even if the content is the same, so rebasing rewrites history. The old commits remain reachable via the reflog (ORIG_HEAD).

git rebase origin/main
All Git & GitHub questions Roadmap: Git & GitHub

More on Merge, rebase and cherry-pick