Skip to main content

Description

The dvc destroy command removes all DVC-related files from your project, including the .dvc directory, configuration files, and local cache. This effectively uninitializes DVC from your repository.
This is a destructive operation that deletes your local cache. Make sure you’ve pushed important data to a remote storage before running this command.

Usage

Arguments

This command takes no arguments.

Options

flag
Force destruction without asking for confirmation.By default, DVC asks for user confirmation before destroying the repository. Use this flag to skip the confirmation prompt (useful for automation).

What Gets Deleted

When you run dvc destroy, the following are permanently removed:
The entire .dvc directory, including:
  • Configuration files (.dvc/config, .dvc/config.local)
  • Local cache (.dvc/cache/)
  • Temporary files
  • Internal state files
All information about your data pipelines:
  • Stage definitions in dvc.yaml
  • Pipeline dependencies and outputs
  • Metrics and plots configurations
All cached data files:
  • Original versions of tracked files
  • Historical versions from previous commits
  • Cached pipeline outputs
Data in cache is permanently deleted. Ensure you’ve run dvc push to backup to remote before destroying.
What is NOT deleted:
  • .dvc files (e.g., data.csv.dvc) - These remain as regular files in your Git repository
  • Remote storage - Data in remote storage (S3, GCS, etc.) is unaffected
  • Git repository - Your Git history and tracked files remain intact

Examples

Destroy with Confirmation

Destroy Without Confirmation

Use --force in automated scripts or CI/CD pipelines where user interaction isn’t possible.

Before You Destroy

1

Backup to Remote

Ensure all important data is pushed to remote storage:
2

Check Status

Verify no uncommitted changes:
3

Document Configuration

Save your DVC configuration if you might need it later:
4

List Tracked Files

Document what files are tracked by DVC:

After Destruction

After running dvc destroy:

Project State

Cleanup Git Repository

You may want to remove DVC-related files from Git:

Reinitialize DVC

If you want to start fresh:

Use Cases

Switch to Different Tool

Remove DVC when migrating to a different data versioning solution.

Clean Installation

Start fresh with a clean DVC setup after configuration issues.

Remove from Project

Permanently remove DVC from a project that no longer needs it.

Testing & Development

Quickly reset DVC state during testing or development.

Safety Checks

Dry Run Alternative

DVC destroy doesn’t have a dry-run option, but you can check what would be deleted:

Verify Remote Backup

Before destroying, verify your data is safely in remote storage:
If dvc status --cloud shows differences, some data hasn’t been pushed to remote and will be lost during destroy.

Comparison: destroy vs. remove

Recovery After Accidental Destroy

If you accidentally destroyed DVC:
1

Reinitialize DVC

2

Restore Configuration

If you have a backup of your config:
Or restore from Git history:
3

Pull Data from Remote

This restores all cached data from remote storage.
4

Verify Status

Should show everything is in sync.
As long as you have:
  1. .dvc files in Git
  2. dvc.yaml (if using pipelines)
  3. Data in remote storage
You can fully recover by reinitializing and running dvc pull.

Troubleshooting

Permission Denied

Solution: Check file permissions or run with appropriate privileges:

Not a DVC Repository

Solution: You’re not in a DVC-initialized directory. Either:
  • Navigate to the correct directory
  • DVC may already be destroyed

Files in Use

Solution: Close any programs accessing DVC cache files, then try again.

Automation Example

CI/CD Pipeline Cleanup

  • dvc init - Initialize DVC (opposite of destroy)
  • dvc push - Upload data to remote before destroying
  • dvc status --cloud - Check if data is backed up to remote
  • dvc remove - Remove specific DVC-tracked files (not entire setup)
  • dvc gc - Clean up cache without destroying DVC setup