createVersionFromCommit(
args: {commit:Pick<LixCommit,"id">;id?:string& {__lixGenerated?:true; };inheritsFrom?:null|LixVersion|Pick<LixVersion,"id">;lix:Lix;name?:LixGenerated<string>; }):Promise<LixVersion>
Creates a new version that starts at a specific commit.
commit_id to the provided commit.working_commit_id that references an empty change set (global scope).inheritsFrom and defaults to "global".// Branch from a commit
const v = await createVersionFromCommit({ lix, commit });// Custom id and name
const v = await createVersionFromCommit({ lix, commit, id: "my-id", name: "My Branch" });// Inherit from a specific version
const parent = await createVersion({ lix, name: "base" });
const v = await createVersionFromCommit({ lix, commit, inheritsFrom: parent });// Opt-out of inheritance
const v = await createVersionFromCommit({ lix, commit, inheritsFrom: null });| Parameter | Type | Description |
|---|---|---|
args | { commit: Pick<LixCommit, "id">; id?: string & { __lixGenerated?: true; }; inheritsFrom?: null | LixVersion | Pick<LixVersion, "id">; lix: Lix; name?: LixGenerated<string>; } | - |
args.commit | Pick<LixCommit, "id"> | The commit to branch from (only id is required). |
args.id? | string & { __lixGenerated?: true; } | Optional explicit version id. |
args.inheritsFrom? | null | LixVersion | Pick<LixVersion, "id"> | Optional lineage: a parent version to inherit from, or null to disable; defaults to "global". |
args.lix | Lix | The Lix instance. |
args.name? | LixGenerated<string> | Optional version name. |
Promise<LixVersion>
If the provided commit id does not exist.