Deleting Components

If you are looking just to remove the component from your local workspace, head to Removing components.

Deleting components in Bit requires a careful approach to ensure integrity and avoid unintentional disruptions in dependent projects. By default, components are soft deleted, i.e. marked as deleted without being fully removed, ensuring they remain accessible to dependent components.

To delete components in your workspace, run the following command:

$bit
Copiedcopy
See command synopsis

Recover deleted components

Run the following command to recover a removed component (specify the full component ID):

$bit
Copiedcopy
See command synopsis

The output should display the following:

✔ importing components (completed in 5s) successfully recovered my-org.my-scope/foo/bar

The recovered component is imported to your workspace. It's status is modified since it is not longer configured as deleted. Tag and export it to make it visisble and available again in the remote scope.

$bit
Copiedcopy
$bit
Copiedcopy

Deleting component from a Lane

Deleting components in a Lane, removes the component from the lane itself. It does not, by default, delete the component entirely from the main lane. The effect is to revert any changes made to that component in the lane.

$bit
Copiedcopy
See command synopsis
note

If you still depend on the deleted component in that lane, you will need to install it as a package bit install <component-package-name>

To propagate the deletion to the main lane, i.e. to fully delete the component from the scope (which will take effect only when the lane is merged to main), add the --update-main flag:

$bit
Copiedcopy
See command synopsis

Hard delete components

Run the following command to remove a component from a remote scope permanently (specify the full component ID):

$bit
Copiedcopy
See command synopsis
warning

Permanently deleting components might cause issues as dependents won't be able to use the component. Prefer bit delete or bit deprecate components instead ensure safe deletion of components.

Delete component versions

You can delete a specific component version or an entire semver range using the range flag:

bit delete hello-world --range 1.1.2
CopiedCopy