Fast-forward
In one line
A fast-forward merge happens when the target branch has not advanced since the source branch was created — Git simply moves the pointer forward without a merge commit.
In simple words
A fast-forward merge is the simplest type of merge. It occurs when the target branch (e.g. main) has no new commits since the source branch (e.g. feature) was created. In this case, Git does not need to combine anything — it just moves the target branch pointer forward to the source branch's latest commit.
No merge commit is created in a fast-forward merge. The history remains a straight line. This is the cleanest possible merge.
If the target branch HAS advanced (both branches have new commits), Git cannot fast-forward and must create a merge commit (a "three-way merge"). You can force a merge commit even when a fast-forward is possible with git merge --no-ff, which preserves the branch topology in history.
Example
# If main has not advanced since feature branched off:
git checkout main
git merge feature
# Git prints: Fast-forward
# Force a merge commit even if fast-forward is possible:
git merge --no-ff featureFast-forward just moves the pointer; --no-ff forces a merge commit.
Related terms
Related Resources
Related Lessons
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.