branch
fork
Fork a new branch from the current head of a source branch.
strata branch forkdb.branches.fork(source: 'str', name: 'str', *, version: 'Optional[int]' = None, timestamp: 'Optional[int]' = None) -> 'Any'wire branch_fork_current
Forks a new branch from the source branch's current head. The new branch sees all data visible on the source at fork time; later writes on either branch stay isolated. The returned branch summary records the parent name, fork version, and generation.
On the CLI, all three fork commands share the single verb `strata branch fork <SOURCE> <BRANCH>`: with no flags it runs this command, while `--version` routes to `branch.fork_at_version` and `--timestamp` routes to `branch.fork_at_timestamp` (both wire-surface commands).
Successful mutations return an acknowledgement of the outcome: for a state-changing write, the affected target with the mutation effect and commit facts; for mutations that produce a domain result (such as a branch or a promotion outcome), that result object.
To see the complete help for this command, run:
strata branch fork --helphelp(db.branches.fork)
Example
Fork a branch from another branch's head.
strata branch fork default experimentstrata branch list
_ = db.branches.fork("default", "experiment")sorted(b.name for b in db.branches.list())
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| branch | string | yes | Destination branch name. |
| source | string | yes | Source branch name. |
Returns
MutationAck<BranchItem>
- dataBranchItem
- typestring
Errors
Recover by code. Retry policy and commit outcome come from the shipped error registry.
| Code | Retry | Commit outcome |
|---|---|---|
| failed_precondition.engine.runtime_closed | never | not_started |
| not_found.engine.branch | never | not_applicable |
| invalid_argument.engine.branch_name | never | not_started |
| invalid_argument.engine.branch_name_reserved | never | not_started |
| already_exists.engine.branch | never | not_started |