Skip to content

Extend UserMergeBranch with a squash option

Problem

We want to introduce an Squash and merge strategy to support a merge with a squash option. All merge request's commits should be squashed and this squashed commit is added to the target branch without a merge commit.

We already support a squash via UserSquash RPC, but this call only creates a squash commit but it doesn't add it to the target branch. To merge it, we use UserMergeBranch RPC and pass the squashed commit via commit_id.

It's a two step process:

  1. UserSquash - to generate squash commit
  2. UserMergeBranch - to add squash commit from previous step + merge commit to the target branch

This approach works, but it leads to creation of an additional merge commit that we want to avoid.

Proposal

This MR explores an option to pass squash to directly to UserMergeBranch to create a squashed commit instead of a merge commit.

The process will contain only one step:

  1. UserMergeBranch + squash: true - to generate a squash commit and merge it into a target branch
Edited by Vasilii Iakliushin

Merge request reports