Skip to content
BENIBIX Learn

Squash Merge vs Fast-Forward Merge

People think a squash merge and a fast-forward are the same, because both leave main in a straight line. They are not. A fast-forward makes no new commit. Main's label just slides onto the branch's own commits, so every one of them is kept. A squash merge makes one new commit for the whole branch, and the branch's own commits stay off main.

Development🔀 Version Control

Squash Merge

Merging a branch as one commit. Main's history stays short.

A squash merge turns all the commits on a branch into one new commit. That one commit lands on the target branch. The small steps, like typo fixes, do not show up in main's history. GitHub offers this as Squash and merge on a pull request. The branch's own commits are not kept on main.

Example
Lucy's branch has twelve small commits. She squash-merges it, and main gets one commit: Add a dark mode switch.
Why it matters
Main shows one commit per feature. That is easy to read and easy to undo.
Full entry
Development🔀 Version Control

Fast-Forward Merge

A merge where Git just slides the branch forward. No merge commit is made.

A fast-forward merge happens when the target branch has not moved since the other branch split off. There is nothing to combine. Git just moves the branch label forward to the newest commit. No new merge commit is made, and the history stays in one straight line. If both branches have new commits, a fast-forward is not possible.

Example
Nobody touched main while Emma worked. Her merge is a fast-forward, and main now points at her last commit.
Why it matters
It keeps history in a straight line that is easy to read.
Full entry

In one line

Squash Merge
Merging a branch as one commit. Main's history stays short.
Fast-Forward Merge
A merge where Git just slides the branch forward. No merge commit is made.