Lesson 6 of 9 · 6 min read
Merge request rules
Decide who may merge, close or delete merge requests from the app, what must be true before merging, and which ways of merging your team allows.
What you’ll learn
- Who sets the merge request rules.
- How to choose, per action, which roles may take it.
- How to require a passing pipeline and approvals.
- What people see when a button is greyed out.
Who sets them
People merge, close or delete their features' merge requests on each merge request's page. Settings › Merge requests sets the rules for your organisation. The Org Owner changes them, and can tick Admins can change them too. Others can look.
These actions are always done with the person's own GitLab account, so GitLab's own permissions apply as well. Claude never merges, approves or deletes. Every action, and every refusal, is in the audit log.
1 · Actions and who may take them
Under Actions and who may take them, for each action:
- Merge — into the target branch, when it's ready;
- Close — without merging; the branch stays;
- Delete — removes the merge request from GitLab (GitLab allows this to project owners only); the branch stays.
Turn each action on or off and tick the roles that may take it: Org Owner, Admins, Members. New organisations start with every action on for everyone.
2 · Before merging
- The pipeline must have passed — Merge stays greyed out until the latest pipeline has succeeded.
- It must be approved — all the approvals GitLab asks for, and at least one.
3 · How merging works
- Ways of merging people can pick — merge commit, squash then merge, rebase then merge. Tick what your team allows; the merge dialog offers only those.
- Offer to delete the source branch when merging — adds that option to the dialog.
A worked example
Acme Logistics wants developers to merge their own work, but safely.
- Merge: on, for Org Owner, Admins and Members.
- Close: on, for everyone. Delete: on, for the Org Owner only.
- Tick The pipeline must have passed and It must be approved.
- Under Ways of merging people can pick, keep only squash then merge.
- Click Save the rules. They apply at once.
A developer opening a merge request with a failed pipeline now sees Merge greyed out with the reason: Your organisation requires a passing pipeline; it is failed.
Tip: the server checks everything again with fresh data from GitLab before acting. A page left open for an hour can't merge something that has since stopped being mergeable.
What people see
A button that can't be used is greyed out with its reason — for example Connect your own GitLab account when someone hasn't connected theirs. That message is the most common one in the first week: ask everyone to connect GitLab in Connected accounts.
Check yourself
1. Can an admin change these rules?
Only if the Org Owner ticked Admins can change them too.
2. Your team allows only squash merges. What do people see in the merge dialog?
Only squash then merge; the other ways aren't offered.
3. Can Claude merge a merge request it opened?
No. Merging, closing and deleting are done by people, with their own GitLab account.