Fast-Forward Merge
What
A Fast-Forward Merge is the simplest and cleanest way to combine branches. It occurs when the base branch has not received any new commits since the feature branch was originally created.
How
When you merge a branch that is directly ahead of your base branch, Git does not need to perform a three-way merge or generate a merge commit. Instead, it simply “fast-forwards” the base branch pointer to reference the same commit hash as the tip of the feature branch:
# Before fast-forward merge:
C feature_branch
/
A - B main
# After running 'git merge feature_branch' while on 'main':
feature_branch
A - B - C main
Since the history is linear, no merge commit is created. The tip of main is moved directly to C.
Why
Fast-forward merges keep your repository’s commit history completely linear and easy to read. In a single-developer workflow or a highly disciplined team environment, fast-forwarding avoids the clutter of empty “Merge branch ‘x’” commits, making the timeline straightforward to audit and navigate.
Summary
If no new changes have been added to the base branch since branching occurred, Git performs a fast-forward merge, moving the base pointer forward without creating a new merge commit.