跳到正文

第 26 课 · Projects and Reference

DVC Glossary and Command Cheat Sheet

A quick DVC reference: plain-language glossary, command cheat sheet for tracking, remotes, pipelines and experiments, file overview and a daily routine.

Keep this page open while you work. It collects the terms and commands from the course in one place. Options can change between releases, so confirm details with dvc <command> --help or the official command reference.

Glossary

Term Meaning
Artifact A file, such as a model, described in dvc.yaml with an ID and details
Cache Local content-addressed storage for tracked data
Checkout Making workspace data match the pointer files
DAG Directed acyclic graph of pipeline stages
Data registry A repository shared mainly for datasets and models
Dependency An input that makes a stage rerun when it changes
.dvc file Small pointer file describing tracked data
dvc.lock Recorded state of the last reproduced pipeline
dvc.yaml Pipeline, metrics, plots and artifact definitions
Experiment A recorded run you can compare or apply
Metrics Numbers that describe results
Output A file or folder a stage creates
Parameter A named setting tracked from a parameters file
Remote Shared storage for cache objects
Run cache Records of past stage runs used to restore results
Stage One command with its dependencies and outputs
Workspace The project files you see and edit

Files at a glance

File or folder Purpose Commit to Git?
.dvc/config Shared settings Yes
.dvc/config.local Private settings No
.dvc/cache/ Data objects No
*.dvc Pointers to tracked data Yes
.dvcignore Skip patterns Yes
dvc.yaml Pipeline and definitions Yes
dvc.lock Pipeline snapshot Yes
params.yaml Parameters Yes

Setup and tracking

Terminal
dvc init                         # start DVC in a Git repo
dvc doctor                       # environment report
dvc add data/x.csv               # track data
dvc status                       # what changed
dvc data status --granular       # detailed state
dvc diff HEAD~1                  # data changes between revisions
dvc checkout                     # match workspace to pointers
dvc unprotect data/x.csv         # make a linked file editable
dvc move old new                 # rename tracked data
dvc remove data/x.csv.dvc        # stop tracking

Remotes and sharing

Terminal
dvc remote add -d storage <url>  # add a default remote
dvc remote modify --local storage <option> <value>
dvc push                         # upload
dvc pull                         # download and check out
dvc fetch                        # download into the cache
dvc status -c                    # compare cache with remote
dvc list <repo> <path>           # browse a repository
dvc get <repo> <path>            # download once
dvc import <repo> <path>         # download and remember the source
dvc import-url <url> <out>       # track external data
dvc update <file.dvc>            # refresh an import

Pipelines and results

Terminal
dvc stage add -n <name> -d <dep> -o <out> <command>
dvc dag
dvc repro                        # run what changed
dvc repro --dry                  # preview
dvc repro -f                     # force
dvc freeze <stage>
dvc unfreeze <stage>
dvc params diff
dvc metrics show
dvc metrics diff
dvc plots show
dvc plots diff

Experiments

Terminal
dvc exp run -S key=value -n name
dvc exp run --queue -S key=a,b
dvc queue start --jobs 2
dvc exp show --only-changed
dvc exp diff
dvc exp apply <name>
dvc exp branch <name> <branch>
dvc exp push origin <name>
dvc exp remove <name>

Maintenance and teamwork

Terminal
dvc install                      # Git hooks
dvc gc -w -a -T --dry            # preview cleanup
dvc cache dir <path>             # move the cache
dvc config cache.type "reflink,copy"

Commands that delete (dvc gc, especially with -c, and dvc destroy) need a backup plan and agreement from your team.

Which command do I need?

Data questions

Track a file dvc add
Get old data git checkout, dvc checkout
Missing data dvc pull
1 / 2

Quiz yourself with code

This stand-in lists common needs and commands. Predict each command before you run it.

Python Stand-in: command flashcards

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Daily routine

  1. git pull, then dvc pull.
  2. Make changes on a branch.
  3. Run dvc repro or dvc exp run.
  4. Check dvc metrics diff and dvc params diff.
  5. Commit, run dvc push, then git push.

Where to go next

Read the official DVC documentation for storage backends and new features. To broaden your skills, see MLOps, Python and the Git tutorial. As of December 2026, DVC is maintained under lakeFS, and this tutorial is independent of that company.

When you adopt DVC in a real project, start with one dataset and one remote. Add a pipeline once the data workflow feels natural, then parameters, metrics and experiments. Introducing everything at once makes problems harder to locate. Write your team's rules for pushing, reviewing and cleaning in the README, and revisit them after a few weeks of use.

Pick the right history tool

Newcomers often mix up three things that all feel like "going back". Use this table to choose:

Goal Use
Restore an old dataset version Git to restore the pointer, then dvc checkout
Rebuild a pipeline result dvc repro
Try a different setting without a commit dvc exp run
Bring a good experiment into your work dvc exp apply
Get files that are only in storage dvc pull

Warning signs

Stop and investigate when you notice any of these: a data file appears in git status; a teammate cannot pull a commit you just pushed; a stage reruns although nothing changed; dvc.lock changes in a pull request that should only touch documentation; or someone suggests deleting the cache or the bucket to fix a problem. Each is easy to solve early and expensive to solve after several more commits.

Practice from memory

Without looking up the answer, describe the full path of one new dataset version: which command records it, which files you commit, which two pushes share it, and which two commands a teammate runs to receive it. If you can explain this clearly, you understand the core of DVC. Everything else, from pipelines to experiments, builds on that loop of recording, committing and sharing.

Before you ask for help

Gather the command you ran, the full error, the output of dvc doctor and a short description of what changed. Remove secrets and private paths. A clear report often leads you to the answer while you are writing it.

A cheat sheet helps you remember names, but it cannot tell you whether a command is safe in your situation. For anything that deletes or overwrites, read the full help text and preview first.

Check your understanding

Quick check · 3 questions

of 3 answered You scored / 3 · perfect!

  1. 1. Which file should you NOT commit to Git?

    The local config holds private settings.
  2. 2. Which command previews a pipeline run?

    A dry run prints what would run.
  3. 3. What does dvc fetch do?

    Fetch fills the cache without changing workspace files.

Summary

  • Pointer files, dvc.yaml, dvc.lock and parameters belong in Git.
  • Data flows through the cache and the remote.
  • repro runs what changed; exp records and compares trials.
  • Preview destructive commands and protect secrets.
  • Check the official command reference for current options.

You have finished the course. Go back to the DVC tutorial overview to revisit any chapter.

你的学习进度保存在此浏览器中,无需账号。