Remove Components from a lane

The following workflows demonstrate how to remove components from a lane, in different states of the lane/components.

When merging a lane with removed components into another lane (or 'main), the removed components from the source lane will not be removed from the target lane.

Note that commands are demonstrated on a single component but can be applied to multiple components, as well. For example, the following command uses a glob pattern to remove all components from the my-org.my-scope scope that have the ui namespace:

$bit
Copiedcopy

Remove a component

The following workflow demonstrates how to remove a component in the following cases:

  • When the component to be removed has never been snapped on a lane (the component status is either 'new' or 'modified')
  • When the component to be removed has been snapped on a lane, but the lane has never been exported

If the component to be removed has been snapped on a lane and the lane has been exported, follow this workflow.

To remove a component, run the following:

$bit
Copiedcopy

The output should confirm that the component has been removed from the workspace:

successfully removed the following components from the workspace:

my-component
caution

A component removed in the aforementioned scenarios, cannot be recovered!

Remove a component that has been snapped on an exported lane

Run the following to remove a component that has been snapped on a lane that has already been exported:

$bit
Copiedcopy

The output should confirm that the component has been marked as removed:

successfully marked the following components as removed:
my-org.my-scope/my-component@a1f1902f7317f7281f658db92407eb9a8bc73cc2
to update the remote, please snap and then export. to revert, please use "bit recover"

Run the following to snap the changes (the component is now set as 'removed'):

$bit
Copiedcopy

The output should confirm that the component has been snapped:

1 component(s) snapped on "my-org.my-scope/my-lane" lane

changed components
(components that got a version bump)
> my-org.my-scope/my-component@be78062a110da99cc417d8248091e3b37edb7a03

Run the following to export the changes:

$bit
Copiedcopy

The output should confirm that the component has been removed from the remote lane:

exported the following 1 component(s) from lane: my-lane my-org.my-scope/my-component@df871137d6cc14970975fc6a40781b952df0e9b the following component(s) have been marked as removed on the remote my-org.my-scope/my-component@df871137d6cc14970975fc6a40781b952df0e9b

Run bit recover COMPONENT_ID to undo the removal of the component from the remote lane.

Remove a component from the workspace without affecting the lane

To remove a component only from a workspace, without affecting the lane, run the following:

$bit
Copiedcopy

The output should confirm that the component has been removed from the workspace:

successfully removed the following components from the workspace:

my-component

This option is useful when a component from a lane is no longer maintained (no longer requires updates), but should nevertheless remain in the lane.

To restore a component that was removed from the workspace, check it out from the lane and into your workspace.