Skip to main content
The +ephemeral namespace stores refs separately from the default namespace. Use it for previews, CI artifacts, and other isolated work. Insert +ephemeral before .git in the repository URL:
Two rules apply to every ref that you write through this URL:
  • A normal git clone does not show the ref. Code Storage puts the ref in the ephemeral namespace. The normal repository URL hides that namespace.
  • A connected GitHub repository does not receive the ref. Code Storage never mirrors an ephemeral ref to an upstream host.
An ephemeral branch gives you isolation inside one repository. It shares the Git objects and access rules. It remains until you delete or promote it. Promote an ephemeral branch when you want it in the default namespace. Use a fork when you need separate repository access. The other namespace, Import Namespace, accepts a push only and follows different rules.

Setup

Add a named remote when you use the namespace often:
This remote accepts standard Git commands.

Quick start

Push and pull ephemeral branches with standard Git commands:

Promote a branch

Fetch an ephemeral branch. Then push it to the main remote.

Behavior

  • Base: Name a base for each ephemeral branch: base_branch in repos.commits.create, or base_ref in repos.branches.create. When you work with Git, clone the normal remote as your base. The ephemeral remote has no default branch.
  • Isolation: An ephemeral branch can have the same name as a branch in the default namespace. The two branches remain separate until promotion.
  • Shared objects: Ephemeral branches reuse Git objects that are already in the repository. This reduces storage use.
  • HTTP API and Git: Git operations work as usual. An operation reads an ephemeral ref when you set its ephemeral field, and writes one when you set target_is_ephemeral. base_is_ephemeral and source_is_ephemeral read the base or the source from the ephemeral namespace.

SDK examples

Create an ephemeral branch

Set target_is_ephemeral to write a commit to the ephemeral namespace. Set ephemeral to read or list the files of an ephemeral branch. In Go, the fields are TargetIsEphemeral and Ephemeral.

Branch from an ephemeral base

Set base_is_ephemeral when another ephemeral branch is the base. Also set base_branch.

Promote an ephemeral branch

Promote an ephemeral branch to the default namespace with repos.branches.create. Keep the same branch name or use a new name.
This operation keeps the ephemeral branch. Delete that branch when you no longer need it.