Types of merge rules
Explore the types of merge rules.
読み終わるまでの所要時間 1 分最終更新 9ヶ月前
Learn what merge rules are available and refer to examples on how you can apply them. Find more information on how to set up merge rules.
Only allow reviewed merges
To only allow users to merge branches if they have an approved code review, use the following rule:
only_allow_merges_if_reviewed
only_allow_merges_if_reviewed
example
only_allow_merges_if_reviewedThe following example applies to all repositories and ensures that all branches that follow the naming pattern need an approved review before they merge to the branch:
QUAK-*main[{ "enabled": true, "repositories": "*", "rule": "only_allow_merges_if_reviewed", "to": { "branchNames": ["main"] }, "from": { "branchNames": ["QUAK-*"], }}]
Restrict merges to a branch
To ensure that merges to a specific branch can only come from a defined set of branches, use the following rule:
restrict_merges_to_branch
restrict_merges_to_branch
example
restrict_merges_to_branchThe following example applies to only the repository. The merge rule ensures that only merges from source branches named can merge to the destination branch :
examplerepofixes-*/fix3.0[{ "enabled": true, "repositories": "examplerepo", "rule": "restrict_merges_to_branch", "to": { "branchNames": ["/fix3.0"], }, "from": { "branchNames": ["fixes-*"], }}]
Only allow merges from a parent branch
To only allow merges to a given branch if the merge is from its parent branch, use the following rule:
only_allow_merges_from_parent
only_allow_merges_from_parent
example
only_allow_merges_from_parentThe following example applies to repositories that match the name . This rule ensures that any branches that match the name can only receive merges from a parent branch:
game*task*[{ "enabled": true, "repositories": "game*", "rule": "only_allow_merges_from_parent", "to": { "branchNames": ["task*"], }}]
Only allow merges from a child branch
To only allow merges to a given branch if the merge is from its child branches, use the following rule:
only_allow_merges_from_children
only_allow_merges_from_children
example
only_allow_merges_from_childrenThe following example applies to repositories that match the name . This rule ensures that any branches that match the name can only receive merges from their child branches.
game*iteration*