By default, the main
branch is accessible to all
project users and anyone can make changes to its files. To restrict changes and who can push
commits to it, you may want to set restrictions on it to allow branch merges only after they
are approved.
- In the
left navigator, click
Project Administration
.
- Click Branches.
- In Repository and Branches,
select the Git repository and the
main
branch.
- Select the Requires Review option.
- In Default Reviewers, enter and select the users.
A default reviewer is a project member who is automatically added
as a reviewer when a merge request is created on the branch.
- From the Approvals drop-down list, select the minimum
number of reviewers who must approve the review branch of a merge request, where
the selected branch is the target branch
- (Optional) To allow a review branch to be merged to the selected branch only if
the last build of the linked job in Merge Request is successful, select the
Require successful build check box.
To use this option, link a build job to a merge request.
- (Optional) If you want to reset the approval status of reviewers if change is
pushed to a branch after they have approved the merge request, select the
Reapproval needed when branch is updated check
box.
- (Optional) To ensure changes pushed to the target branch match the contents of
the review branch, select the Changes pushed to target branch must
match review content check box.
- (Optional) In Merge Request Exempt Users, specify users
who can bypass the branch restrictions and merge the review branch of a merge
request outside VB Studio or without required approvals.
This is useful if you want to allow some users to merge the review branch
irrespective of review conditions being met.
- Click Save.