How do I prevent merging pull requests (to master), except by a particular user or group

Patrik Helsing
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 19, 2018

On this page I can find the following quote:

"If your team requires stricter control, consider using branch permissions to restrict who can merge a pull request to particular users or groups"

 

However on the page about branch permissions there is only a possibility to 

- Prevent all changes (except by user/group)

- Prevent changes without a pull request (except by user/group)

How am I supposed to restrict merging a pull requests (to master), except by a particular user or group?

2 answers

0 votes
Julius Davies [bit-booster.com]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 22, 2018

 

Suppose you have 10 users, but you only want to let your users "Aloysius" and "Bartholomew" merge PR's to master.  Then setup the config like so by setting both rules:

 

1. Prevent changes (to master) without a pull request (with no exceptions)

2. Prevent all changes (to master) with "Aloysius" and "Bartholomew" set as the exceptions.

 

The combination of those two rules makes it so only Aloysius and Bartholomew can get work into 'master', but they must use PR's to do so. 

Note: under this setup they can merge any branch into 'master', including branches they did not create or push themselves, and branches that don't contain any commits by them.  But only they can click on the 'Merge' button if the target of the PR is 'master'.

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 21, 2018

Hi Patrik! You'll need to use a combination of branch permissions and default reviewers. I assume you don't want changes to be pushed directly to Master without a pull request, so first, you'll need to apply branch permissions and choose to 'Prevent changes without a pull request' (this prevents pushing changes directly to the specified branch; changes are allowed only with a pull request).

Second, you'll need to add default reviewers (this can be a single user or a group). This will allow you to set a group of users that need to approve the change before it can be merged to Master, for more info you can read  Add default reviewers to pull requests.

Will that work for you?

Kind regards,

Ana

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events