/api/repos/{repo_name}/diff-commit endpoint and is designed for workflows
that already have git diff --binary output available.
createCommitFromDiff shares the same branch metadata (expectedHeadSha, baseBranch,
ephemeral, ephemeralBase) as createCommit. Instead of calling .addFile(), pass the patch
contents through the diff field. The SDK accepts strings, Uint8Array, ArrayBuffer, Blob/File
objects, or any iterable/async iterable of byte chunks and handles chunking + base64 encoding. In
Go, the Diff field accepts an io.Reader.
The gateway applies the patch with git apply --cached --binary, so make sure your diff is
compatible with that command. It must include file headers (diff --git), mode lines, and hunk
headers. Empty patches and patches that do not apply cleanly result in a RefUpdateError with the
mapped status ( conflict, precondition_failed, etc.) and partial ref update information.
Options
string
required
Branch name that will receive the commit.
string
required
The commit message.
string
required
Provide
name and email for the commit author.string
required
The patch content (string, bytes, async iterable, or
io.Reader in Go).string
Commit SHA that must match the remote tip.
string
Branch to seed from if target doesn’t exist.
string
Store in the ephemeral namespace.
string
Use when the base branch is also ephemeral.
string
Provide
name and email. Defaults to author if omitted.object[]
Ordered per-ref policy rules (
{ pattern, ops? }) embedded in the per-call JWT. First match wins. Python: ref_policies. Go: RefPolicies with type storage.RefPolicyList. See the Branch Protection guide.Response
string
The SHA of the created commit
string
The SHA of the commit’s tree object
string
The branch that received the commit
number
Size of the uploaded pack in bytes
object
Contains
branch, oldSha/old_sha, and newSha/new_sha