We have a project with following three main branches:
- development: used to deploy to DEV environment
- staging: used to deploy to staging environment
- release: used to deploy to production environment
Our default merging strategy is Squash, fast-forward only --squash --ff-only i.e., <span>If the source branch is out of date with the target branch, reject the merge request. Otherwise, combine all commits into one new non-merge commit on the target branch.</span>
We like this strategy for PRs where the source branch is a temporary branch created by the developer for purposes of code-checkin, <em>but this policy is not desired when the source branch is one of {development, staging, release}</em>. And I think this is a common use-case and scenario. However we cannot find any setting to allow a different merge strategy when the source branch is one of {development, staging, release}.
How can we do this? I think what we are asking is common practice in development where any on-going changes are committed as --squash --ff-only by developers but merges between the three canonical branches are made using the traditional merge strategy of <span>Merge commit </span>--no-ff i.e.:
Always create a new merge commit and update the target branch to it, even if the source branch is already up to date with the target branch.