Skip to content

MVP: Display squash settings information in branch rule

Context

Issues: Merge Request Squash Settings per protected bra... (#290042 - closed) #500458 (closed)

Users would like to be able to specify squash behavior overrides on a per protected branch basis

  • I need to be able to "require squash" on protected branches
    • because otherwise high-volume branches become a horrible mess - when you have hundreds of devs active daily on a single project, a clean trunk/protected-branch history is critical and "oh, just teach them to rebase and squash themselves" is nonsense
    • note that this is also a motivation for related high-popularity issue #1822, which looked like it was finally getting some attention in 16.10, but then... didn't.
  • I need to be able to not require squash on non-protected branches (even though I do on protected branches)
    • because using MRs to "merge down" from protected to team feature branches can be helpful for teams (and squashing such "merge down" MRs completely breaks merge history / makes no sense), and also because doing regular merges from user/story branches to shared feature/wip branches can also be helpful for teams User Goals
  • Users want flexibility in configuration and settings, and the ability to configure squash commits on a protected branch level

MVP Design Proposal

Allow the user to view the squash settings on the Branch Rule details page.

🎨 Figma

Current: Branch rules overview Proposed: Branch rules "Add branch rule" with documentation
Current_ Branch rules overview.jpg Proposed_ Branch rules overview squash merge documentation.png
Current: Branch rules overview table Proposed: Branch rules overview table with squash merge line

Current_ Branch rules overview table.jpg

Resolving branch rule overlaps specifies how squash merge setting overlaps resolve to the most specific branch rule

Proposed_ Branch rules overview table with squash merge.jpg

Current: Branch rule details Proposed: Branch rule details

Current_ Branch Rule Details Page.jpg

Default value of branch rule squash setting

All branches default: Show value from Project-level squash setting. See "Project-level squash setting mirrors "All branches" squash setting"

Proposed_ Branch Rule Details Page 1 - Default - All branches.jpg

Branch name default: No default set until defined by user

[Design to be added]

All protected branches default: No default set until defined by user

[Design to be added]

Edit squash setting

Proposed_ Branch Rule Details Page 2 - Edit squash setting.jpg

Save button confirmation toast

Proposed_ Branch Rule Details Page 3 - Confirmation toast.jpg

Wildcard branch rules: no squash settings displayed (out of scope for MVP)

Proposed_ Branch Rule Details Page 4 - Wildcard page has no squash settings.jpg

Default value of branch rule squash setting

The following defaults will be used. Designs for the "No default set until defined by user" will be added to this issue.

  • Branch name No default set until defined by user
  • All protected branches No default set until defined by user
  • All branches Show value from Project-level squash setting. See below.

Project-level squash setting mirrors "All branches" squash setting

The current project-level squash setting lives in: Settings > Merge requests > Squash commits when merging. A project-level squash setting is equivalent to Add branch rule > All branches.

For now, the recommendation is to mirror squash settings across the project-level and "All branches" squash setting. Changing the project-level squash setting should automatically update the "All branches" squash setting, and vice versa.

Resolving branch rule overlaps

If a single branch falls under multiple branch rules, the most specific squash rule will apply. The following hierarchy should be followed and included in the updated documentation:

  1. Branch name (most specific)
  2. All protected branches
  3. All branches / Project-level squash setting (least specific)

Tiering information

Context: &15526 (comment 2237136180)

The decision is that functionality to configure this on a per-branch basis will be in GitLab Premium. This aligns with organizations looking to configure specific workflows across their projects to support complicated workflows. How this will work:

  1. For All Branches which aligns with the project setting, the configuration will remain in GitLab Free. This makes sense as squash settings are already in free and the representation in All Branches is purely a UI change.
  2. For All Protected Branches OR Specific Named Branch, the configuration will be part of GitLab Premium. This makes per branch configuration the component which moves the squash settings up a tier here.

Out of MVP Scope

The following are out of scope for this iteration, and may be considered in the future:

  • Squash settings for wildcard branch rules (Add branch rule > Branch name or pattern) are excluded at this time to avoid complications with branch rule conflicts and hierarchy
  • Regex for branch rules, and respective squash settings
  • Branch rules for non-protected branches, and respective squash settings
  • User-defined branch rule prioritization
  • Consolidating Project-level squash setting / All branches squash setting
  • Additional edge cases: #500458 (closed)
Edited by Alyssa Trinh