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.
| Current: Branch rules overview | Proposed: Branch rules "Add branch rule" with documentation |
|---|---|
|
|
| Current: Branch rules overview table | Proposed: Branch rules overview table with squash merge line |
|---|---|
|
Resolving branch rule overlaps specifies how squash merge setting overlaps resolve to the most specific branch rule |
| Current: Branch rule details | Proposed: Branch rule details |
|---|---|
|
Default value of branch rule squash setting
[Design to be added]
[Design to be added] |
|
|
Edit squash setting |
|
|
Save button confirmation toast |
|
|
Wildcard branch rules: no squash settings displayed (out of scope for MVP) |
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 nameNo default set until defined by user -
All protected branchesNo default set until defined by user -
All branchesShow 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:
-
Branch name(most specific) All protected branches-
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:
- For
All Brancheswhich 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 inAll Branchesis purely a UI change. - For
All Protected BranchesORSpecific 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)








