Get branch merge preview

branchMergePreview(branchId: ID!, targetBranchId: ID): BranchMergePreview!

Requires project.read.

Arguments

ArgumentTypeRequiredDescription
branchIdID!YesBranch to merge. A missing branch and one the caller cannot read are both not found.
targetBranchIdIDNoTarget branch ID; omit for main.

Response

Returns BranchMergePreview!. Open the type for its fields and nested types.

FieldTypeDescription
sourceBranchBranch!
targetBranchIdIDBranch that receives the merge, or null for main.
targetBranchNameString!
canMergeBoolean!True only when blockedReason is null, merge policies pass and no file has conflicts. Advisory: the merge checks these conditions again.
blockedReasonStringPrecondition that blocks the merge, such as a merged or closed branch, or a target that is the source branch or is closed; null when none does. A target that is missing or in another project is a not found error.
hasConflictsBoolean!
diffs[BranchMergeFileDiff!]!

Types marked with ! cannot be null. Lists use [Type] notation. The type index lists all published input and response types.

Example

graphql
query BranchMergePreview($branchId: ID!, $targetBranchId: ID) {
  branchMergePreview(branchId: $branchId, targetBranchId: $targetBranchId) {
    blockedReason
    canMerge
    hasConflicts
    targetBranchId
    targetBranchName
  }
}
json
{
  "branchId": "00000000-0000-4000-8000-000000000001"
}