Skip to main content
const preview = await repo.previewMerge({
  sourceBranch: "feature/preview",
  targetBranch: "main",
  includeContent: true, // optional bounded conflict blob content
});

console.log(preview.status); // "clean" or "conflicted"
console.log(preview.result); // "merge_commit", "fast_forward", or "no_op"

if (preview.status === "conflicted") {
  console.log(preview.conflictPaths);
  console.log(preview.filteredConflicts);

  for (const conflict of preview.conflicts) {
    console.log(conflict.path);
    console.log(conflict.result.content);
  }
}
previewMerge() is read-only. It checks the merge result with a git:read scoped request and does not create commits or update refs. Pass includeContent when you want inline conflict blob content. The response still includes conflictPaths when content is omitted or filtered.

Options

sourceBranch
string
required
Source branch name to merge from.
targetBranch
string
required
Target branch name to merge into.
includeContent
boolean
Include bounded conflict blob content in conflicts when the preview is conflicted. Python: include_content. Go: IncludeContent as *bool.
ttl
number
Token TTL for this invocation in seconds. In Go, use TTL as a time.Duration.

Response

Field names below use TypeScript casing. Python returns snake_case keys and Go returns exported struct fields.
status
string
Preview status: clean or conflicted.
result
string
Merge outcome if applied: merge_commit, fast_forward, or no_op.
sourceBranch
string
Resolved source branch name.
targetBranch
string
Resolved target branch name.
sourceTipSha
string
Source branch tip SHA used for the preview.
targetTipSha
string
Target branch tip SHA used for the preview.
mergeBaseSha
string
Merge base SHA when the backend reports one.
conflictPaths
string[]
Paths that would conflict if the merge were applied.
conflicts
object[]
Inline conflict details for each returned path. Each item has path, result, base, ours, and theirs fields. ours is the target branch stage and theirs is the source branch stage. Blob fields include oid, content, truncated, and binary.
filteredConflicts
object[]
Conflicted paths whose inline content was omitted. Each item has path and reason, such as max_conflict_files_exceeded.

Notes

  • conflicts is empty when includeContent is omitted or set to false.
  • filteredConflicts tells you which conflicted files were left out of the inline preview and why.
  • Use merge() after a clean preview when you are ready to update the target branch.