Skip to content

Commit 85c01f0

Browse files
author
majin.nathan
committed
docs: clarify main branch reference semantics
1 parent 704b234 commit 85c01f0

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

docs/src/format/table/branch_tag.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ Branch names must follow these validation rules:
1717
4. Cannot contain `..` or `\`
1818
5. Segments must contain only alphanumeric characters, `.`, `-`, `_`
1919
6. Cannot end with `.lock`
20-
7. Cannot be named `main` (reserved for main branch)
20+
7. Cannot be named `main` (reserved for the default branch)
21+
22+
`main` is a virtual name for the default branch. It may appear in API reference contexts as an alias for the default branch, but no branch metadata file named `main.json` is created.
2123

2224
### Branch Metadata Path
2325

@@ -38,7 +40,7 @@ Each branch metadata file is a JSON file with the following fields:
3840

3941
| JSON Key | Type | Optional | Description |
4042
|------------------|--------|----------|--------------------------------------------------------------------------------|
41-
| `parentBranch` | string | Yes | Name of the branch this was created from. `null` indicates branched from main. |
43+
| `parentBranch` | string | Yes | Name of the branch this was created from. `null` indicates branched from the default branch. |
4244
| `parentVersion` | number | | Version number of the parent branch at the time this branch was created. |
4345
| `createAt` | number | | Unix timestamp (seconds since epoch) when the branch was created. |
4446
| `manifestSize` | number | | Size of the initial manifest file in bytes. |
@@ -117,7 +119,7 @@ Each tag file is a JSON file with the following fields:
117119

118120
| JSON Key | Type | Optional | Description |
119121
|-----------------|--------|----------|--------------------------------------------------------------------------|
120-
| `branch` | string | Yes | Branch name being tagged. `null` or absent indicates main branch. |
122+
| `branch` | string | Yes | Branch name being tagged. `null` or absent indicates the default branch. |
121123
| `version` | number | | Version number being tagged within that branch. |
122124
| `createdAt` | string | Yes | RFC 3339 timestamp for when the tag was first created. |
123125
| `updatedAt` | string | Yes | RFC 3339 timestamp for the latest tag reference update. |

docs/src/guide/tags_and_branches.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ The `reference` parameter (used in `create`, `update`, and `checkout_version`) a
2020
- `("experiment", 3)` means version 3 on the experiment branch
2121
- `("branch-name", None)` means the latest version on that branch
2222

23+
In reference contexts, `"main"` is an alias for the default branch and is equivalent to `None`.
24+
2325
!!! note
2426

2527
Creating or deleting tags does not generate new dataset versions.
@@ -77,7 +79,7 @@ The `reference` parameter works the same as for Tags (see above).
7779

7880
Each branch maintains its own linear version history, so version numbers may overlap across branches. Use `(branch_name, version_number)` tuples as global identifiers for operations like `checkout_version` and `tags.create`.
7981

80-
"main" is a reserved branch name. Lance uses "main" to identify the default branch.
82+
`"main"` is reserved for the default branch. Use `"main"` or `None` when referring to the default branch in reference tuples or checkout APIs, but choose a different name when creating, deleting, or updating branches.
8183

8284
### Create and checkout branches
8385
```python
@@ -99,6 +101,8 @@ ds.tags.create("experiment-rc", ("experiment", None))
99101
experiment_rc = ds.checkout_version("experiment-rc")
100102
# Checkout the latest version of the experimental branch by tuple
101103
experiment_latest = ds.checkout_version(("experiment", None))
104+
# Checkout the latest version of the default branch explicitly
105+
main_latest = ds.checkout_version(("main", None))
102106

103107
# Create a new branch from a tag
104108
new_experiment = ds.create_branch("new-experiment", "experiment-rc")

docs/src/quickstart/versioning.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ For advanced tag operations (e.g., tagging versions on specific branches), see [
9595

9696
Branches manage parallel lines of dataset evolution. You can create branches from existing versions or tags, read and write to them independently, and checkout different branches.
9797

98+
`main` refers to the default branch in checkout and reference APIs, but it is reserved and cannot be used as the name of a new branch.
99+
98100
```python
99101
# Create branch from current latest version
100102
experiment_branch = ds.create_branch("experiment")

0 commit comments

Comments
 (0)