2

dvc documentation for dvc gc command states, the -r option indicates "Remote storage to collect garbage in" but I'm not sure if I understand it correctly. For example I execute this command:

dvc gc -r myremote

What exactly happens if I execute this command? I have 2 possible answers:

  1. dvc checks which files should be deleted, then moves these files to "myremote" and then deletes all these files in local cache but not in remote.
  2. dvc checks which files should be deleted and deletes these files both in local cache and "myremote"

Which one of them is correct?

NShiny
  • 1,046
  • 1
  • 10
  • 19

1 Answers1

4

one of DVC maintainers here.

Short answer: 2. is correct.

A bit of additional information: Please be careful when using dvc gc. It will clear your cache from all dependencies that are not mentioned in the current HEAD of your git repository. We are working on making dvc gc preserving whole history by default.

So if you don't want to delete files from your history commits, it would be better to wait for completion of this task.

[EDIT] Please see comment below.

don_pablito
  • 382
  • 1
  • 9
  • 2
    @NShiny, this behaviour only works if `-c` flag is specified altogether with `-r` (ex. `dvc gc -c -r my_storage`). Sorry for not mentioning that in the original answer. – don_pablito Sep 30 '19 at 09:22
  • This must have been part of the documentation. Getting to find it in stackoverflow is alarming. – jeffry copps Dec 16 '22 at 05:05