Description
Thedvc 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.
Usage
Arguments
This command takes no arguments.Options
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 rundvc destroy, the following are permanently removed:
.dvc/ Directory
.dvc/ Directory
The entire
.dvc directory, including:- Configuration files (
.dvc/config,.dvc/config.local) - Local cache (
.dvc/cache/) - Temporary files
- Internal state files
Pipeline Information
Pipeline Information
All information about your data pipelines:
- Stage definitions in
dvc.yaml - Pipeline dependencies and outputs
- Metrics and plots configurations
Local Cache
Local Cache
All cached data files:
- Original versions of tracked files
- Historical versions from previous commits
- Cached pipeline outputs
What is NOT deleted:
.dvcfiles (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
Before You Destroy
After Destruction
After runningdvc 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:Comparison: destroy vs. remove
| Feature | dvc destroy | dvc remove |
|---|---|---|
| Scope | Entire DVC setup | Specific stage/file |
| Deletes cache | Yes, entire cache | Only related files |
| Deletes .dvc/ | Yes | No |
| Reversible | No (destructive) | Partially |
| Removes from Git | No | Yes (with Git commit) |
Recovery After Accidental Destroy
If you accidentally destroyed DVC:As long as you have:
.dvcfiles in Gitdvc.yaml(if using pipelines)- Data in remote storage
dvc pull.Troubleshooting
Permission Denied
Not a DVC Repository
- Navigate to the correct directory
- DVC may already be destroyed
Files in Use
Automation Example
CI/CD Pipeline Cleanup
Related Commands
dvc init- Initialize DVC (opposite of destroy)dvc push- Upload data to remote before destroyingdvc status --cloud- Check if data is backed up to remotedvc remove- Remove specific DVC-tracked files (not entire setup)dvc gc- Clean up cache without destroying DVC setup