Run the following to list all lanes available in your workspace:
The output notifies of the current checkout lane and lists additional lanes that are available in the workspace:
Available lanes:
> my-org.my-scope/my-lane (0 components)
> main (0 components)
Run the following command to switch to a lane (available locally) using its lane name:
By default, components that do not already exist in your workspace, will not be checked out.
To check out all components in a lane, run the command with the --get-all
flag:
If you have modified components in your workspace (that are not snapped), you can switch to a different lane and merge these component changes with the checked out components from the lane you are switching to:
Provide the --merge
flag with a merging strategy: theirs
, ours
or manual
To switch to a lane that is not available in your workspace, provide the command with the full lane ID:
Alternatively, run the following to import a lane and switch to it:
When importing a lane, all its component will be checked out, including those that are not currently maintained in the workspace (similar to the
bit switch LANE_ID --get-all
)
When you switch to a lane, your workspace .bitmap
file references that lane.
For example, the following switches to the my-lane
lane:
The .bitmap
file is updated to reference that lane:
"_bit_lane": { "id": { "name": "my-lane", "scope": "my-org.my-scope" }, "exported": false }
Components listed in the .bitmap
file are marked as isAvailableOnCurrentLane
, if they are part of the checked-out lane.
{ "my-component": { "scope": "", "version": "5bde67a71c29be5a6d256ab37130bb6a7499aef5", "mainFile": "index.ts", "rootDir": "my-scope/my-component", "onLanesOnly": true, "isAvailableOnCurrentLane": true }, }
Components marked as onLanesOnly
and isAvailableOnCurrentLane
will be handled by Bit (and show up in commands like bit status
and bit list
), only when you are on that lane.
For example, the following workspace is now set to the my-lane
lane:
The output confirms that the workspace is now set to the my-lane
lane. Components in that lane are listed.
author: Jane <jane@my-org.com> created: 5/17/2023, 12:28:03 PM components (1) my-component@5bde67a71c29be5a6d256ab37130bb6a7499aef5
When listing the components in that workspace, the same components listed above are shown:
The output is as follows:
Note that
new
components will not show up in the output ofbit lane show
, but will show up in the output ofbit list
, as they are not part of any lane yet.
If you switch to "main lane" or another lane, the .bitmap
file is updated accordingly.
For example, the following switches to the "main lane":
Components available only on the "my-lane" lane, are now set as isAvailableOnCurrentLane: false
:
{ "my-component-on-main": { "scope": "", "version": "5bde67a71c29be5a6d256ab37130bb6a7499aef5", "mainFile": "index.ts", "rootDir": "my-scope/my-component-on-main", "onLanesOnly": true, "isAvailableOnCurrentLane": false } }
Bit will ignore these components, unless you switch back to the "my-lane" lane.
For example, running the following, while still on the "main lane":
Will show no components are available in the workspace:
That means that the components listed in the .bitmap
file are marked as isAvailableOnCurrentLane: false
and are no longer handled by Bit.
When you run bit list
you will only see components that are marked as isAvailableOnCurrentLane: true
Having the components' files in your workspace directory does not mean these components are part of that lane! This is contrary to Git, where files in your working directory are part of the branch you are on. To understand this better, let's look at the following scenario:
- The
hello-world
component is in the workspace directory. A newer version of that component is in themy-lane
lane. - The
goodbye-world
component is not in the workspace directory, but is in themy-lane
lane. - The
hello-moon
component is in the workspace directory, and is not in themy-lane
lane.
The following shows the workspace directory before switching to the my-lane
lane:
Let's run the following to check out the my-lane
lane:
Now that the workspace has switched to my-lane
lane, the workspace directory is updated as follows: