Merging feature branches: to squash or to no-ff?

We are discussing how we merge feature branches back into thier parent branch, usually “develop” or “main”. This can be done locally if the developer has permission to commit to the develop branch, or on the origin, e.g. using github or devops Pull Request “merge” feature. Which ever way its done, we want a single commit on the target branch representing that feature, so it can be easily put into, or pulled out of, a release etc.

First we need to understand what is a merge commit. This article sums it up well:

There are several merge strategies:

  1. merge –no-ff
  2. merge –squash
  3. rebase
  4. other.

Note, we usually never want fast forward, as this would result in several commits instead of one for a particular feature.

Choosing the right one is important for later actions, such as cherry picking and bug fixing.