Add ability to reset branch-level squash settings to project defaults

What does this MR do and why?

This MR adds the ability to reset branch-level squash settings to inherit from project defaults, resolving issue #575818.

Previously, when a squash setting was configured on a specific branch rule, there was no way to remove that configuration and revert to using the project-level default setting. Users had to either:

  1. Remove and recreate the branch protection (leaving the branch unprotected temporarily)
  2. Manually set the branch-level value to match the project setting (breaking inheritance)

Screenshots or screen recordings

before after
Screenshot_2025-11-05_at_09.45.02 Screenshot_2025-11-05_at_09.42.56
Screenshot_2025-10-31_at_09.48.43 Screenshot_2025-10-31_at_09.48.46

How to set up and validate locally

  1. Navigate to a project's Settings > Repository > Branch rules
  2. Create or edit a branch rule (not "All branches", not a branch rule using wildcards)
  3. Configure a squash setting for the branch rule
  4. Edit the squash settings again - you should now see a "Default" option
  5. Select "Default" and save - this will remove the branch-level override and inherit from project settings
  6. Verify the branch rule no longer shows a specific squash setting but inherits from project level

Note: The "Default" option is intentionally not available for the "All branches" rule since that rule defines the project-level defaults.

Why "Default" option is not available for "All branches"

The "All branches" rule defines the project-level default squash settings.

Issue #575818

Edited by Jacques Erasmus

Merge request reports

Loading