git merge (fast-forward)
When one branch is strictly ahead of the other.
A fast-forward merge happens when the target branch has not moved since the feature branch was created. There is a straight, unbroken line of commits between them. In this case Git does the simplest thing possible: it just slides the branch pointer forward. No new commit. No new object. Just a file write.
Watch the Pointer Slide
main is at commit C. feature is two commits ahead at E. Hit merge and watch what happens — or rather, what doesn't happen.
feature is strictly ahead of main — there is a direct linear path between them. No divergence.Why No New Commit?
Git asks one question before merging: "Is the target branch an ancestor of the source branch?" If the answer is yes — meaning you can walk backwards from feature and reach main — there is nothing to reconcile. Every commit on main is already in feature's history.
Creating a merge commit in this situation would be noise — an empty commit that says "merged" but carries no real information. So Git skips it.
Forcing a Merge Commit
Some teams prefer a merge commit even in fast-forward situations, so the history explicitly records when a feature branch was integrated. Use --no-ff to force it:
This creates a merge commit with two parents even though a fast-forward was possible. The trade-off: cleaner history vs. more explicit branching record. Both approaches are valid — pick one and be consistent.
Reading the Output
Git tells you when a merge was fast-forwarded. The key indicator is the arrow — it shows the old hash advancing to the new one, and the commit count is just the new commits on feature.