@lancedb/lancedb • Docs
@lancedb/lancedb / Branches
Class: Branches¶
Branch manager for a Table.
Unlike tags, create and checkout return a new Table handle scoped
to the branch; writes on it do not affect main.
Methods¶
checkout()¶
Check out an existing branch and return a handle scoped to it.
With version set, the returned handle is pinned to that version of the
branch (a read-only, detached view); otherwise it tracks the branch's
latest and stays writable.
Parameters¶
-
name:
string -
version?:
number
Returns¶
Promise<Table>
create()¶
Create a branch and return a handle scoped to it.
Parameters¶
-
name:
stringName of the new branch. -
fromRef?:
stringSource branch to fork from. Defaults tomain. -
fromVersion?:
numberA specific version onfromRef. Defaults to latest.
Returns¶
Promise<Table>
delete()¶
Delete a branch.
Parameters¶
- name:
string
Returns¶
Promise<void>
diff()¶
Compare a branch against main without modifying either branch.
Parameters¶
- fromBranch:
string
Returns¶
Promise<BranchDiff>
list()¶
List all branches, mapping name to branch metadata.
Returns¶
Promise<Record<string, BranchContents>>
merge()¶
Merge a branch into main.
Set dryRun to true to preview the merge. A rejected merge resolves
with status: "rejected" instead of throwing.
Parameters¶
-
fromBranch:
stringBranch to merge from. -
dryRun:
boolean=falseWhen true, only preview the merge. Defaults to false.
Returns¶
Promise<MergeBranchResult>