intermediateMerging & Rebasing
Rebase
The Definition
Rebase moves or combines a sequence of commits to a new base commit.
Mental Model
"Rebase is like taking a stack of cards, moving the stack to a different table, and then dealing them out again. It creates new commits with new hashes."
Visual Simulation
Live Engine
Watch Out (Common Pitfalls)
!
Rebasing commits that have been shared (pushed) with others
!
Not understanding rebase creates new commits with new hashes
!
Using rebase when merge would be more appropriate
Hands-on Command
shell
~ $
git checkout feature
git rebase main