Updated on 2023-07-25 GMT+08:00

Merge Requests

To configure merge requests, choose Settings > General Settings > Merge Requests on the repository details page. The settings take effect only for the repository configured. Only the repository administrators and owners can view this tab page and configure merge requests.

Rules you set take effect in Merge Request Approval. The parameters are described as follows:

Table 1 Configuration description

Item

Description

Creators cannot merge requests.

If this option is selected, creators cannot merge their own branches.

Closed merge requests cannot be re-opened.

If this option is selected, the branch merge request cannot be set back to the enabled status after it is closed.

This option is used for project process control to prevent review history from being tampered with.

Merge after complete resolution

If this option is enabled, code cannot be merged until all review comments marked as 'Must resolve' are addressed.

Delete source branch after merge

After the merge is successful, the source branch is deleted.

  • The source branch set as a protection branch will not be deleted.
  • This setting does not take effect for historical merge requests. Therefore, you do not need to worry about branch loss.

Merge Method

Currently, Merge commit, Merge commit with semi-linear history, and Fast-forward are supported. For details, see the description on the Merge Requests page.

Merge Mechanism

There are two types of mechanisms: Approval and Score.

NOTICE:

By default, the Approval is used. You can manually switch to Score.

Merge Mechanism

  1. Score: Code review is included. The minimum score can be set. The score ranges from 0 to 5. Score and code review are gates that must be passed before a merge can be accepted.
  2. Approval: The Approval method consists of code review and merge approval. Code can be merged only after the number of reviewers reaches gate requirements. Click Create Policy to set a merge policy for a specified branch or all branches in the repository.

    Table 2 Parameter description

    Parameter

    Description

    Branch Name

    You can select a specified branch or all branches of the repository.

    Review before merge

    If this option is selected, the adapted branches can be merged only after meeting all review rules.

    Minimum number

    The value ranges from 1 to 5.

    Reset reviewers after new push

    Reset reviewers when pushing data to a source branch in a merge request.

    Select from these reviewers

    The range of reviewers can be specified.

    If the branch policy is not set, the approval information is not displayed in the merge condition after a merge request is initiated.

    • Rules: If you select Review before merging, reviewers can approve or reject merge requests to meet higher code quality requirements.
    • Rules: Select Pass pipeline gates. Before the merge, you need to pass all pipeline gates. This rule integrates the pipeline into the code development process.