Skip to main content
A fork is an independent copy of an existing Code Storage repository. It starts from one source commit and has its own branches and access. After the copy, a change in one repository does not reach the other.

When to use a fork

  • Templates: Create new projects from a starter template
  • Experiments: Test changes in an independent repository
  • Snapshots: Capture a repository’s state at a specific commit or branch
  • Isolation: Separate work across a trust or tenant boundary, or give each user an independent project of their own
For per-agent and per-task isolation inside a single repository, use the ephemeral namespace instead. Those branches share the repository’s Git objects and its access, and you can promote the work you keep.

Quick start

baseRepo takes id, ref, and sha. See createRepo() for the full parameter list and resolution order. That page also explains which default branch the fork inherits.

Use cases

Project templates

Create new projects from a starter template:

Point-in-time snapshots

Capture a repository’s state before you make risky changes:

Fork or sync

Limitations

  • Same organization: You can only fork repositories within your own organization
  • No relationship tracking: Forks are independent. Code Storage keeps no “parent” reference after creation. No route merges a fork back into its source
  • No upstream: A fork records no upstream, so pullUpstream() on a fork returns HTTP 400 with repository has no upstream configured. To get later changes, add the source repository as a second Git remote. Fetch and merge the changes
  • Full copy: Forks include all branches and history up to the fork point