From 78faf12908df191b029294bec072fce95f39ef1e Mon Sep 17 00:00:00 2001 From: Nikita Kodenko Date: Thu, 25 Jun 2020 02:28:34 +0700 Subject: [PATCH 1/8] remove: updated to match with core repo * `dvc remove` description updated according to implementation (see https://github.com/iterative/dvc/issues/4094 for context) * `--outs` description updated according to implementation. * `.gitignore` described in examples. * Removed extra params: `-p`, `-f`. * Removed shorthand for `--outs` (i.e. `-o`). * Updated command description. --- content/docs/command-reference/remove.md | 38 +++++++++++------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/content/docs/command-reference/remove.md b/content/docs/command-reference/remove.md index aa5ed00045..18797d1b26 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 stage entries, `.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 the stage entry from +[dvc.yaml](/doc/user-guide/dvc-files-and-directories#dvcyaml-file) or the `.dvc` +file itself, 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,7 +41,7 @@ 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` data file, and track it with DVC: ```dvc $ dvc add data.csv @@ -54,6 +49,10 @@ $ ls data.csv* data.csv data.csv.dvc + +$ cat .gitignore + + /data.csv ``` Remove `data.csv` data file: @@ -62,12 +61,9 @@ Remove `data.csv` data file: $ dvc remove data.csv.dvc $ ls data.csv* - data.csv.dvc -``` + data.csv -Purge `.dvc` files: +$ cat .gitignore | wc -l -```dvc -$ dvc remove data.csv.dvc -p -$ ls data.csv* + 0 ``` From 0a4c05a6509e1ddfb3a08dffaacb8fdbc0484d73 Mon Sep 17 00:00:00 2001 From: nik123 Date: Fri, 26 Jun 2020 13:15:30 +0700 Subject: [PATCH 2/8] Apply suggestions from code review Co-authored-by: Jorge Orpinel --- content/docs/command-reference/remove.md | 25 +++++++++--------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/content/docs/command-reference/remove.md b/content/docs/command-reference/remove.md index 18797d1b26..94966ccfff 100644 --- a/content/docs/command-reference/remove.md +++ b/content/docs/command-reference/remove.md @@ -13,13 +13,11 @@ positional arguments: ## Description -This command safely removes stage entries, `.gitignore` entries and optionally +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 the stage entry from -[dvc.yaml](/doc/user-guide/dvc-files-and-directories#dvcyaml-file) or the `.dvc` -file itself, and optionally removes all of its outputs (outs field). +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 @@ -41,29 +39,24 @@ how it can be used to replace or modify files that are tracked by DVC. ## Examples -Let's imagine we 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 +/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 - +data.csv $ cat .gitignore | wc -l - 0 +0 ``` From 04e9355c3b0422de7716ee8f1aa94d0b7ee79b06 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 26 Jun 2020 06:15:39 +0000 Subject: [PATCH 3/8] Restyled by prettier --- content/docs/command-reference/remove.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/content/docs/command-reference/remove.md b/content/docs/command-reference/remove.md index 94966ccfff..9bcdcc0d62 100644 --- a/content/docs/command-reference/remove.md +++ b/content/docs/command-reference/remove.md @@ -13,9 +13,11 @@ positional arguments: ## Description -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 +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 it, and optionally removes all of its outputs (`outs` field). @@ -39,7 +41,8 @@ how it can be used to replace or modify files that are tracked by DVC. ## Examples -Let's imagine we have a `data.csv` file t is that already [tracked](link to dvc add cmd ref please) 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 @@ -50,7 +53,8 @@ $ cat .gitignore /data.csv ``` -Remove the `data.csv.dvc` file, and check that the data file is gone from `.gitignore`: +Remove the `data.csv.dvc` file, and check that the data file is gone from +`.gitignore`: ```dvc $ dvc remove data.csv.dvc From d81e627bb6bc33e84db88d2593ba418870776aa2 Mon Sep 17 00:00:00 2001 From: Nikita Kodenko Date: Fri, 26 Jun 2020 15:16:50 +0700 Subject: [PATCH 4/8] cmd ref: remove: updated example --- content/docs/command-reference/remove.md | 31 +++++++++++++----------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/content/docs/command-reference/remove.md b/content/docs/command-reference/remove.md index 9bcdcc0d62..d4e405d974 100644 --- a/content/docs/command-reference/remove.md +++ b/content/docs/command-reference/remove.md @@ -41,26 +41,29 @@ how it can be used to replace or modify files that are tracked by DVC. ## Examples -Let's imagine we have a `data.csv` file t is that already [tracked](link to dvc -add cmd ref please) with DVC: +Let's imagine we have `foo.csv` and `bar.csv` files that are already [tracked](/doc/command-reference/add) +with DVC: ```dvc -$ dvc add data.csv -$ ls data.csv* -data.csv -data.csv.dvc +$ ls *.csv* +bar.csv +bar.csv.dvc +foo.csv +foo.csv.dvc $ cat .gitignore -/data.csv +/bar.csv +/foo.csv ``` -Remove the `data.csv.dvc` file, and check that the data file is gone from +Remove the `foo.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 - -0 +$ dvc remove foo.csv.dvc +$ ls *.csv* +bar.csv +bar.csv.dvc +foo.csv +$ cat .gitignore +/bar.csv ``` From 8b82643df356b0b24cd15dd462c934d4facd5778 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 26 Jun 2020 08:17:12 +0000 Subject: [PATCH 5/8] Restyled by prettier --- content/docs/command-reference/remove.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/command-reference/remove.md b/content/docs/command-reference/remove.md index d4e405d974..d46f76e6f6 100644 --- a/content/docs/command-reference/remove.md +++ b/content/docs/command-reference/remove.md @@ -41,8 +41,8 @@ how it can be used to replace or modify files that are tracked by DVC. ## Examples -Let's imagine we have `foo.csv` and `bar.csv` files that are already [tracked](/doc/command-reference/add) -with DVC: +Let's imagine we have `foo.csv` and `bar.csv` files that are already +[tracked](/doc/command-reference/add) with DVC: ```dvc $ ls *.csv* From 125b79a3bba32a9cf5424bab2671fc83ef50806b Mon Sep 17 00:00:00 2001 From: nik123 Date: Fri, 26 Jun 2020 17:18:20 +0700 Subject: [PATCH 6/8] Update content/docs/command-reference/remove.md Co-authored-by: Jorge Orpinel --- content/docs/command-reference/remove.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/command-reference/remove.md b/content/docs/command-reference/remove.md index d46f76e6f6..243a603aa9 100644 --- a/content/docs/command-reference/remove.md +++ b/content/docs/command-reference/remove.md @@ -30,7 +30,7 @@ how it can be used to replace or modify files that are tracked by DVC. ## Options -- `--outs` - remove outputs as well. +- `--outs` - remove the outputs described in the given `targets` as well. - `-h`, `--help` - prints the usage/help message, and exit. From 75cfb0f3c312ad4285cb2dd02af582425fca4865 Mon Sep 17 00:00:00 2001 From: nik123 Date: Fri, 26 Jun 2020 17:18:44 +0700 Subject: [PATCH 7/8] Update content/docs/command-reference/remove.md Co-authored-by: Jorge Orpinel --- content/docs/command-reference/remove.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/command-reference/remove.md b/content/docs/command-reference/remove.md index 243a603aa9..a15e1b66dd 100644 --- a/content/docs/command-reference/remove.md +++ b/content/docs/command-reference/remove.md @@ -1,6 +1,6 @@ # remove -Remove stage entry, remove `.gitignore` entry and unprotect outputs. +Remove stage, `.gitignore` entry, and unprotect outputs. ## Synopsis From fde187b9138b103e8f947e7d329b8710650e137e Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Sat, 27 Jun 2020 02:14:34 -0500 Subject: [PATCH 8/8] Update content/docs/command-reference/remove.md --- content/docs/command-reference/remove.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/command-reference/remove.md b/content/docs/command-reference/remove.md index a15e1b66dd..327230aa66 100644 --- a/content/docs/command-reference/remove.md +++ b/content/docs/command-reference/remove.md @@ -60,7 +60,7 @@ Remove the `foo.csv.dvc` file, and check that the data file is gone from ```dvc $ dvc remove foo.csv.dvc -$ ls *.csv* +$ ls bar.csv bar.csv.dvc foo.csv