What is the difference between git merge --no-ff and git merge --squash, and when would a team prefer one over the other?

Last updated 6 July 2026

  • git merge --no-ff forces a two-parent merge commit even when a fast-forward is possible, so every branch commit and the feature boundary stay visible.

  • git merge --squash stages the branch's combined changes for you to commit as one flat commit. Individual commits and the merge link are discarded.

  • Prefer --no-ff for auditable, granular history (e.g. reverting whole features). Prefer --squash for a clean linear main when WIP commits add no value.

  • https://medium.com/@davide.rubinetti97/git-rebase-vs-merge-vs-squash-different-strategies-explained-7df068f37578
  • https://git-scm.com/docs/merge-options/2.8.6
  • https://medium.com/@ruqaiya.beguwala/git-merge-no-ff-force-a-merge-commit-avoid-fast-forward-a8c4e042720a
  • https://dev.to/trpricesoftware/git-merge-to-squash-or-fast-forward-3791
  • https://thetrainingboss.com/github-merge-rebase-squash-or-fast-forward/
  • https://lukemerrett.com/different-merge-types-in-git/
  • https://sparkbox.com/foundry/to_squash_or_not_to_squash
  • https://docs.github.com/en/pull-requests/reference/pull-request-merges
All Git interview questions