id | title | permalink | layout | category | prev | next |
---|---|---|---|---|---|---|
cli-remove |
Remove |
docs/cli-remove.html |
docs |
CLI Reference |
cli-remote.html |
cli-show.html |
Removes a component - will delete a specific version, or the entire component and all of its versions. Use this with care. If a component has other components depending on it within the same Scope, you will be required to change them so they will not use it (or use the --force flag).
bit remove|rm [-r|--remote] [-f|--force] [-d|--delete-files] [-s|--silent] [-t|--track] <ids...>
In order to remove a component from a remote Scope, just specify the full component id and add the remote flag --remote
.
bit remove username.your-scope/foo/bar --remote
Note
You have to be an owner or a collaborator on the remote Scope in order to be able to remove components from it.
What happens in case you're trying to remove a component that's already being used by another component?
- When both components are in the same Scope, Bit will prevent you from removing, unless you use the
--force
flag.
bit remove username.your-scope/foo/bar --force
- When the dependent component is in a different Scope, removal will go as planned. That's because a cached version of the removed component will remain on the other Scope, and the dependent component will continue functioning as usual.
In order to remove a component from your local Scope, just specify the local component id (meaning - just namespace and name).
bit remove foo/bar
What happens when other components in your local Scope depend on the removed component?
- If an exported component depends on the removed component, removal will go as planned. That's because a cached version of the removed component will remain.
- If a new component depends on the removed component, removal will go on as planned.
- If a staged component depends on the removed component, Bit will prevent you from removing, unless you use the
--force
flag.
bit remove foo/bar --force
When you try to remove a modified component from your local Scope, Bit will prevent you from doing it, unless you use the --force
flag.
bit remove foo/bar --force
Note
Removing a new component is basically just untracking it, so just use the untrack command for that.
Removing a staged component will remove and untrack it (meaning - it will be removed from the .bitmap file).
If you want Bit to also delete the component files, use the --delete-files
flag:
bit remove foo/bar --delete-files
If, on the other hand, you want to keep tracking it as a new component, use the --track
flag:
bit remove foo/bar --track
Note
If you've tracked and tagged two components, and one depends on the other, removing it will remove its dependency as well.
Accept the remove
prompt, without using --force
.
bit remove foo/bar --silent
-r, --remote
Remove the component from a remote Scope.
bit remove foo/bar --remote
-f, --force
Force remove a component, even if Bit prevents it by default.
bit remove foo/bar --force
-d, --delete-files
Delete the component's files when removing a staged component that hasn't been exported yet.
bit remove foo/bar --delete-files
-t, --track
Keep tracking the component
bit remove foo/bar --track
-s, --silent
Skip remove confirmation
bit remove foo/bar --silent