Code Storage now has a read-only merge preview API for checking whether a source branch can merge into a target branch before attempting a write.
previewMerge() resolves both branch tips, reports the merge result that would be applied, and
returns status: "clean" or status: "conflicted" without creating commits, updating refs, or
requiring a working tree checkout.
const preview = await repo.previewMerge({
sourceBranch: 'feature/preview',
targetBranch: 'main',
includeContent: true,
});
if (preview.status === 'conflicted') {
console.log(preview.conflictPaths);
console.log(preview.filteredConflicts);
}Clean previews include the result that would be produced by a real merge: merge_commit,
fast_forward, or no_op. Conflicted previews return HTTP 200 with status: "conflicted", the
conflicting paths, and optional bounded conflict content when includeContent is enabled.
For large conflict sets, omitted inline content is reported in filteredConflicts with a reason
such as max_conflict_files_exceeded, so callers can build merge UIs without trying to fetch or
render an entire repository by default.