diff --git a/content/docs/command-reference/remove.md b/content/docs/command-reference/remove.md index aa5ed00045..9bcdcc0d62 100644 --- a/content/docs/command-reference/remove.md +++ b/content/docs/command-reference/remove.md @@ -1,11 +1,11 @@ # remove -Remove DVC-tracked files or directories from the workspace. +Remove stage entry, remove `.gitignore` entry and unprotect outputs. ## Synopsis ```usage -usage: dvc remove [-h] [-q | -v] [-o | -p] [-f] targets [targets ...] +usage: dvc remove [-h] [-q | -v] [--outs] targets [targets ...] positional arguments: targets stages (found in dvc.yaml) or .dvc files to remove. @@ -13,13 +13,13 @@ positional arguments: ## Description -This command safely removes data files or directories that are tracked by DVC -from the workspace. It takes one or more stage names (see `-n` -option of `dvc run`) or +This command safely removes stages from +[dvc.yaml](/doc/user-guide/dvc-files-and-directories#dvcyaml-file), their +`.gitignore` entries, and optionally removes from the workspace +files or directories that are tracked by DVC. It takes one or more stage names +(see `-n` option of `dvc run`) or [`.dvc` files](/doc/user-guide/dvc-files-and-directories#dvc-files) as target, -removes all of its outputs (outs field), and optionally removes the stage entry -from [dvc.yaml](/doc/user-guide/dvc-files-and-directories#dvcyaml-file) or the -`.dvc` file itself. +removes it, and optionally removes all of its outputs (`outs` field). Note that it does not remove files from the DVC cache or remote storage (see `dvc gc`). However, remember to run `dvc push` to save the files you actually @@ -30,12 +30,7 @@ how it can be used to replace or modify files that are tracked by DVC. ## Options -- `-o`, `--outs` - remove the outputs described in the given `targets`, keep the - `.dvc` files themselves. **This is the default behavior.** - -- `-p`, `--purge` - remove outputs and `.dvc` files. - -- `-f`, `--force` - force purge. Skip confirmation prompt. +- `--outs` - remove outputs as well. - `-h`, `--help` - prints the usage/help message, and exit. @@ -46,28 +41,26 @@ how it can be used to replace or modify files that are tracked by DVC. ## Examples -Let's imagine have a `data.csv` data file, and track it with DVC: +Let's imagine we have a `data.csv` file t is that already [tracked](link to dvc +add cmd ref please) with DVC: ```dvc $ dvc add data.csv $ ls data.csv* - - data.csv - data.csv.dvc +data.csv +data.csv.dvc +$ cat .gitignore +/data.csv ``` -Remove `data.csv` data file: +Remove the `data.csv.dvc` file, and check that the data file is gone from +`.gitignore`: ```dvc $ dvc remove data.csv.dvc $ ls data.csv* +data.csv +$ cat .gitignore | wc -l - data.csv.dvc -``` - -Purge `.dvc` files: - -```dvc -$ dvc remove data.csv.dvc -p -$ ls data.csv* +0 ```