Skip to content

how to: "undo" 'dvc add' + other "how to undo mistakes" recipes #625

@gwerbin

Description

@gwerbin

This issue is 1 of 3 that I was asked to post here, following a conversation on Discord with mroutis and ivan

I encountered this problem within my first 15 minutes of using DVC: "how do I undo dvc add?"

The answer turns out to be:

  1. unprotect the file, just in case
  2. Delete its corresponding .dvc file
  3. Optionally run gc or look up the MD5 in data.dvc and delete it from .dvc/cache by hand.

It would be nice if this recipe were included somewhere in the docs.

Part of the reason this procedure was so non-obvious is that I never thought to look in https://dvc.org/doc/commands-reference/add. This turns out to have a complete technical explanation of linking, and what "protect" means in DVC. This document should be referenced early and often, maybe with a sentence like "For a technical explanation of the caching and linking process, see here".

In the meantime, hopefully my Stackoverflow self-answer will help other users, as well as get the DVC ball rolling on Stackoverflow.

DVC, like Git, admits the possibility of potentially-destructive beginner mistakes. I think it would be good practice to try and anticipate and provide recipes for undoing mistakes, and link to them prominently in the getting started documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A: docsArea: user documentation (gatsby-theme-iterative)type: enhancementSomething is not clear, small updates, improvement suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions