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.

Create an ephemeral branch from a commit

TypeScript
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
required
Destination branch 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