merge base
The newest commit that two branches both contain, the point where their histories split.
In more detail
Git merges by comparing each branch against this base: a change made on only one side is taken automatically, and a conflict happens only when both sides changed the same lines differently. If the base is your own branch tip, the merge can fast-forward. git merge-base main feature prints it.
Example
git merge-base main featureRelated terms
- merge — Combining the work of two branches into one, either by moving a branch forward (a fast-forward) or by recording a merge commit.
- fast-forward — A merge where the current branch has nothing new, so Git simply moves it forward to the other branch's commit without creating a merge commit.
- merge conflict — The situation where two branches changed the same lines differently since their merge base, so Git cannot combine them and asks you to choose.
- commit range — Two revisions joined by dots to name a set of commits, or with git diff to choose which two states to compare.
Taught in
- Reading History: log, show And diff — Advanced Git Internals & Distributed Workflows
- A Branch Is A Moving Pointer — Advanced Git Internals & Distributed Workflows
- Merging: Fast Forward Or A Merge Commit — Advanced Git Internals & Distributed Workflows
- Rebase: The Same Work, A Different History — Advanced Git Internals & Distributed Workflows
- Why Conflicts Happen — Advanced Git Internals & Distributed Workflows