intermediateMerging & Rebasing
Three-way Merge
The Definition
A three-way merge combines divergent histories by using a common ancestor commit.
Mental Model
"Git looks at three snapshots: the current branch, the branch being merged, and their common ancestor. It creates a new commit that combines changes from both sides."
Visual Simulation
Live Engine
Watch Out (Common Pitfalls)
!
Not understanding the role of the common ancestor
!
Being confused by merge conflicts
!
Not reviewing merge commits carefully
Hands-on Command
shell
~ $
git merge --no-ff feature-branch (force a merge commit)