repos.merge
Merge changes between branches without cloning the repository or shelling out to Git. This endpoint also supports promoting work from ephemeral branches into long-lived branches such as main. Set expected_source_sha to merge the exact source commit that a preview returned, even if the source branch advances. Omit expected_target_sha to merge into the current target tip and allow the gateway to retry stale target/repository movement internally; set expected_target_sha to require a strict target-tip precondition. GitHub-backed public targets currently do not use automatic retry.
Scope: git:write on the repository.
Authorizations
JWT bearer token signed with your organization's registered signing key. There is no OAuth authorization server; you mint tokens yourself and the token's scopes claim carries the granted permission scopes. Public scopes: git:read (read repository contents), git:write (write branches, commits, tags, and notes), repo:write (create and manage repositories), org:read (list an organization's repositories). Each operation's security requirement names the scopes it requires. See https://code.storage/docs/getting-started/authentication for how to mint tokens.
Body
Merge a source branch into a target branch using a merge commit, fast-forward only, or fast-forward preferred behaviour. Source and target can live in the default or ephemeral namespace. Set expected_source_sha to merge the source commit that a preview returned: the merge uses that commit, and fails if source_ref no longer contains it. When expected_target_sha is omitted, the gateway may retry stale target updates internally while keeping the originally resolved source commit pinned. Automatic stale-target retry is disabled for GitHub-backed public targets.
Merge request body specifying source and target branches, optional pinned source SHA, merge strategy, optional squash flag, and optional retry-on-target-move behavior, which is currently unsupported for GitHub-backed public targets.
Merge strategy. merge makes a merge commit, also when a fast-forward is possible. ff_prefer fast-forwards when it can, and else makes a merge commit. ff_only only fast-forwards and never makes a commit. It fails with 412 when the target has commits that the source does not have. When the target already contains the source, each strategy returns no_op and makes no commit.
merge, ff_only, ff_prefer "merge"
Permit merges between unrelated histories.
Optional source commit guard. The merge uses this commit instead of the current tip of source_ref, and fails if source_ref does not contain it when the merge starts. A later advance of source_ref does not change the merged commit.
"9eb378bdb5bf1944f6ba0bd5a2c4df3ce32f4df1"
Response
Merge result, including the source and target commit state after the operation.
Merge outcome including the resulting commit, source and target state, merge base information, and retry attempt counters when applicable.