The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.

Merge Request Settings

Last updated: 2024-09-05 16:16:24

The full name of a merge request is a Merge Request, abbreviated as MR below.
Project administrators can configure the basic settings for merge requests, adjust the default merge method, change the MR default target branch, and set the merge commit message template (Accept Merge Request) on the Settings > Merge Requests page of the code repository.


Basic settings

Delete Source Branch by Default

Deleting the source branch helps keep the repository clean. Once this switch is enabled, the MR request will auto-select the option shown in the image. If you do not want to delete the source branch, the merger can uncheck this button.


Fast-Forward Merge by Default

This feature is mainly to maintain the cleanliness of the trunk branch. This merge mode will not leave any historical information of the merges in the target branch. The commit messages of the source branch will directly merge into the target branch without creating a commit record of the merge, similar to adding the --ff parameter when using the git merge command.

Status Check

Once this feature is enabled, all MRs will automatically trigger a Continuous Integration task on the source branch. Only after passing can they be allowed to merge into the target branch.


All reviewers must allow the merge before merging

This feature is mainly to ensure that all MRs can only be merged with the unanimous consent of all reviewers, regardless of whether the target branch is protected or not.


Merge Mode

Three merge modes are provided when the source branch has multiple commits:
Default direct merge: A merge commit will be created.
Default Squash merge: Multiple commits from the source branch will be squashed into one commit, and users can opt out of this behavior.
Squash merge only: Forces the squashing of multiple commits from the source branch into one commit, and users cannot opt out.

Default Target Branch

After the default branch is specified, it will be automatically set as the target branch when creating merge requests. It is recommended to use the trunk branch as the default target branch for merge requests.

Merge Commit Message Template

All merge requests will leave a commit message in the target branch. For example, the default message in Git is 'Accept Merge Request #xxx.' You can modify this message template here to record the merge results more clearly.


Submit Message Variable

Variable name
Variable Description
Variable Example
${source_branch}
Source Branch
feature/demo
${target_branch}
Target Branch
main
${title}
Merge Request Title
This is a merge request title
${id}
Merge Request Reference Issue Number
#1
${url}
Merge Request Access Link
https://team-name.coding.net/p/project-name/d/depot-name/git/merge/21
${reviewer}
Merge Request Reviewer
@DevelopmentTeamLead
${approver}
Merge Request Allowed to Merge Personnel
@DevelopmentTeamLead
${acceptor}
Merge into Branch Personnel
@Development Team Member
${creator}
Merge Request Creator
@Development Team Member