logo
  • Docs
  • API Reference
    Overview
    Functions
    acceptChangeProposal
    applyChangeSet
    attachConversation
    attachLabel
    commitIsAncestorOf
    commitIsDescendantOf
    createAccount
    createChangeProposal
    createChangeSet
    createCheckpoint
    createConversation
    createConversationMessage
    createHooks
    createLabel
    createLog
    createLspInMemoryEnvironment
    createQuerySync
    createServerProtocolHandler
    createVersion
    createVersionFromCommit
    detachConversation
    detachLabel
    ebEntity
    getTimestamp
    humanId
    mergeVersion
    nanoId
    newLixFile
    nextSequenceNumber
    normalizeDirectoryPath
    normalizeFilePath
    normalizePathSegment
    openLix
    random
    rejectChangeProposal
    selectCommitDiff
    selectVersionDiff
    selectWorkingDiff
    switchAccount
    switchVersion
    transition
    uuidV7
    uuidV7Sync
    validateLixSchema
    validateLixSchemaDefinition
    withWriterKey
    Type Aliases
    Account
    ActiveAccount
    Change
    ChangeAuthor
    DetectedChange
    EntityStateByVersionView
    EntityStateHistoryView
    EntityStateView
    EnvironmentActorHandle
    FromLixSchemaDefinition
    JSONType
    Lix
    LixActiveVersion
    LixChangeProposal
    LixChangeSet
    LixChangeSetElement
    LixCommit
    LixCommitEdge
    LixConversation
    LixConversationMessage
    LixDatabaseSchema
    LixDirectoryDescriptor
    LixEntity
    LixEntityCanonical
    LixEntityConversation
    LixEntityLabel
    LixFile
    LixFileDescriptor
    LixGenerated
    LixHooks
    LixInsertable
    LixKeyValue
    LixLabel
    LixLog
    LixPlugin
    LixSchemaDefinition
    LixSelectable
    LixServerProtocolHandlerContext
    LixUpdateable
    LixVersion
    LixVersionDescriptor
    LixVersionTip
    NewChange
    NewState
    NewStateByVersion
    NewStateByVersionRow
    NewStateRow
    QuerySync
    RenderDiffArgs
    SpawnActorOptions
    State
    StateByVersion
    StateByVersionRow
    StateByVersionRowUpdate
    StateByVersionUpdate
    StateByVersionView
    StateCommitChange
    StateHistory
    StateRow
    StateRowUpdate
    StateUpdate
    StateView
    StateWithTombstonesRow
    StateWithTombstonesView
    StoredSchema
    ToKysely
    Variables
    JSONTypeSchema
    LixAccountSchema
    LixActiveAccountSchema
    LixActiveVersionSchema
    LixChangeAuthorSchema
    LixChangeProposalSchema
    LixChangeSetElementSchema
    LixChangeSetSchema
    LixCommitEdgeSchema
    LixCommitSchema
    LixConversationMessageSchema
    LixConversationSchema
    LixDirectoryDescriptorSchema
    LixFileDescriptorSchema
    LixKeyValueSchema
    LixLabelSchema
    LixLogSchema
    LixSchemaDefinition
    LixStoredSchemaSchema
    LixVersionDescriptorSchema
    LixVersionTipSchema
    mockJsonPlugin
    Classes
    InMemoryEnvironment
    LixObservable
    OpfsSahEnvironment
    Interfaces
    LixEnvironment
    Previous pagecreateVersionNext pagedetachConversation

    #Function: createVersionFromCommit()

    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.

    • Points the new version's commit_id to the provided commit.
    • Generates a fresh working_commit_id that references an empty change set (global scope).
    • Does not modify the active version or any other versions.
    • Inheritance lineage is controlled via inheritsFrom and defaults to "global".

    #Examples

    // 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 });

    #Parameters

    ParameterTypeDescription
    args{ commit: Pick<LixCommit, "id">; id?: string & { __lixGenerated?: true; }; inheritsFrom?: null | LixVersion | Pick<LixVersion, "id">; lix: Lix; name?: LixGenerated<string>; }-
    args.commitPick<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.lixLixThe Lix instance.
    args.name?LixGenerated<string>Optional version name.

    #Returns

    Promise<LixVersion>

    #Throws

    If the provided commit id does not exist.