Skip to main content

Synopsis

Description

The dvc fetch command downloads DVC-tracked files from remote storage to your local cache without updating your workspace. It’s one part of what dvc pull does (the other being dvc checkout). Use dvc fetch when you want to:
  • Pre-download data without immediately checking it out
  • Prepare cache for multiple branch checkouts
  • Download data for later use
  • Populate a shared cache location
  • Backup all remote data locally
Unlike dvc pull, which both downloads and updates workspace files, dvc fetch only populates the cache. To make the files available in your workspace, you need to run dvc checkout afterward.
Think of dvc fetch like git fetch - it downloads data but doesn’t change your working directory. Use dvc pull (like git pull) if you want to download and update your workspace in one step.

Options

path
Limit command scope to specific tracked files/directories, .dvc files, or stage names. If not specified, fetches all tracked data.
string
Remote storage to fetch from. If not specified, uses the default remote configured in .dvc/config.
integer
default:"4 * cpu_count()"
Number of jobs to run simultaneously. Higher values increase parallelism but use more resources.
boolean
default:"false"
Fetch cache for all Git branches. Downloads data for every branch in the repository.
Useful for populating a shared cache or preparing for rapid branch switching.
boolean
default:"false"
Fetch cache for all Git tags.
boolean
default:"false"
Fetch cache for all Git commits.
This can download a massive amount of data. Use only when you need complete history.
boolean
default:"false"
Fetch cache for all dependencies of the specified target.
boolean
default:"false"
Fetch cache for subdirectories of the specified directory.
boolean
default:"false"
Fetch run history for all stages.
integer
Fetch only files/directories that are each below specified size in bytes.
Useful for CI/CD environments with limited storage or bandwidth.
string[]
Only fetch data files/directories that are of a particular type. Can specify multiple times.Choices: metrics, plots

Examples

Basic fetch

Fetch all tracked data to local cache:
Or if cache is up to date:

Fetch then checkout

The two-step equivalent of dvc pull:

Fetch specific files

Fetch only specific targets:

Fetch from specific remote

Fetch all branches

Download data for all branches (great for shared caches):

Fetch with dependencies

Fetch a pipeline stage and all its dependencies:

Fetch small files only

Fetch only files under 50MB:
Useful in CI/CD to skip large model files when only running unit tests.

Fetch only metrics and plots

Parallel fetch

Speed up with more jobs:

Example workflows

Workflow 1: Shared cache setup

Set up a shared cache for your team:

Workflow 2: Branch switching optimization

Pre-fetch data for branches you’ll be working on:

Workflow 3: CI/CD with selective fetch

Workflow 4: Disaster recovery

Backup remote storage to local:

Workflow 5: Prepare for offline work

Understanding fetch vs pull vs checkout

Visual flow

Example comparison

Using fetch + checkout:

Using pull:

When to use fetch instead of pull

Use dvc fetch when:
  • Setting up shared cache
  • Pre-downloading for multiple branches
  • Populating cache for CI/CD
  • You want to review what will be checked out before doing it
  • Working in a script that separates download and checkout steps
Use dvc pull when:
  • You want data immediately in workspace
  • Doing regular development work
  • Simplicity is more important than control
  • You’re syncing after git pull

Performance tips

Maximize parallelism - Use more jobs for faster downloads:
Fetch selectively - Use filters to avoid downloading unnecessary data:
Use shared cache - Configure a shared cache directory to avoid duplicate downloads across team members:
Fetch overnight - For large datasets, fetch all branches overnight:

Error handling

Missing remote

Solution: Configure a remote:

Authentication errors

Solution: Set up credentials for your storage backend.

Disk space issues

Solution: Either:
  1. Free up space
  2. Use --max-size to limit what’s fetched
  3. Use --type to fetch only specific file types
  • dvc pull - Fetch and checkout in one command
  • dvc push - Upload data to remote storage
  • dvc checkout - Update workspace from cache
  • dvc status - Check sync status with remote
  • dvc cache - Manage local cache