Skip to content

Commit

Permalink
Merge pull request #1497 from nik123/fix1490
Browse files Browse the repository at this point in the history
remove: updated to match with core repo
  • Loading branch information
jorgeorpinel authored Jun 27, 2020
2 parents ea09b81 + fde187b commit 3ab081a
Showing 1 changed file with 28 additions and 32 deletions.
60 changes: 28 additions & 32 deletions content/docs/command-reference/remove.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# remove

Remove DVC-tracked files or directories from the <abbr>workspace</abbr>.
Remove stage, `.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.
```

## Description

This command safely removes data files or directories that are tracked by DVC
from the <abbr>workspace</abbr>. 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 <abbr>workspace</abbr>
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
Expand All @@ -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 the outputs described in the given `targets` as well.

- `-h`, `--help` - prints the usage/help message, and exit.

Expand All @@ -46,28 +41,29 @@ 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:

```dvc
$ dvc add data.csv
$ ls data.csv*
data.csv
data.csv.dvc
```

Remove `data.csv` data file:
Let's imagine we have `foo.csv` and `bar.csv` files that are already
[tracked](/doc/command-reference/add) with DVC:

```dvc
$ dvc remove data.csv.dvc
$ ls data.csv*
data.csv.dvc
$ ls *.csv*
bar.csv
bar.csv.dvc
foo.csv
foo.csv.dvc
$ cat .gitignore
/bar.csv
/foo.csv
```

Purge `.dvc` files:
Remove the `foo.csv.dvc` file, and check that the data file is gone from
`.gitignore`:

```dvc
$ dvc remove data.csv.dvc -p
$ ls data.csv*
$ dvc remove foo.csv.dvc
$ ls
bar.csv
bar.csv.dvc
foo.csv
$ cat .gitignore
/bar.csv
```

0 comments on commit 3ab081a

Please sign in to comment.