Skip to main content
Toggle baseIsEphemeral/targetIsEphemeral to work with ephemeral refs. The method returns the API message plus the resolved branch metadata so you can confirm creation before pushing commits.

Let the server name an ephemeral branch

Omit the target branch to let Code Storage allocate a name.
Each call allocates a new branch. If a caller retries after an unknown result, it can create another branch. Store the returned branch name and delete any branch that the caller no longer needs. See Ephemeral Namespace for namespace behavior.

Options

string
Source branch name, full refs/heads/* ref, full refs/tags/* ref, or full commit SHA. Python: base_ref. Go: BaseRef.
string
Deprecated. Use baseRef instead. A call must include this option or baseRef. When you send both options, baseRef takes precedence. Python: base_branch. Go: BaseBranch.
Only an exact 40-character hexadecimal SHA uses the revision path. An abbreviated SHA or a revision expression returns 400.
string
Optional destination branch name. Omit it to let the server allocate a name. It can match the source branch name when you move between namespaces.
boolean
true resolves a branch from the ephemeral namespace. It rejects a tag ref and does not change a full SHA. With the default false, the API rejects all refs/namespaces/* refs, including ephemeral refs.
boolean
true to create/update an ephemeral branch instead of the default namespace.
object[]
Ordered ref policy rules ({ pattern, ops? }) in the JWT for this call. Code Storage uses the first rule that matches the target ref. Python: ref_policies. Go: RefPolicies with type storage.RefPolicyList. See Ref Policies.

Response

string
Confirmation message
string
The created branch name
boolean
Whether the branch is in the ephemeral namespace
string
The tip commit SHA of the new branch