Skip to main content

Synopsis

Description

The dvc diff command shows differences in DVC-tracked data between:
  • Two Git commits
  • A commit and the current workspace
  • Any two Git references (branches, tags, commits)
This helps you understand what data has changed across different versions of your project, similar to how git diff shows code changes. It’s particularly useful for:
  • Comparing model outputs between experiments
  • Tracking dataset evolution over time
  • Understanding what changed in a specific commit
  • Generating reports on data modifications
The output shows which files were added, deleted, modified, or renamed, optionally with their hash values.
dvc diff only shows structural changes (which files changed) and their hashes. For detailed content differences in metrics or params, use dvc metrics diff or dvc params diff.

Options

string
default:"HEAD"
Old Git commit to compare from. Can be a commit hash, branch name, or tag.
string
New Git commit to compare to. Defaults to the current workspace if not specified.
path[]
Specific DVC-tracked files to compare. Accepts one or more file paths.
boolean
default:"false"
Format the output as JSON. Useful for programmatic parsing.
boolean
default:"false"
Display hash values for each entry. Shows first 8 characters of the hash.
boolean
default:"false"
Show tabulated output in Markdown format (GitHub Flavored Markdown).
Great for including in pull request descriptions or documentation.
boolean
default:"false"
Hide files that are not in cache. By default, missing files are shown with “not in cache” status.

Examples

Compare workspace with HEAD

See what data changed since the last commit:

Compare two commits

Compare data between two specific commits:

Compare with previous commit

Show hashes

Display hash values to track exact versions:

Markdown output

Generate a Markdown table (great for PRs):
With hashes:

JSON output

Get structured output for scripting:

Compare specific files

Diff only specific tracked files:

Compare release versions

See what data changed between releases:

Understanding the output

Status types

Hash display

  • Single hash (e.g., d3b07384): Shows first 8 characters for added/deleted files
  • Hash range (e.g., c157a790..f98bf6f1): Shows old and new hash for modified files

Directory notation

Directories are shown with a trailing slash:

Example workflows

Workflow 1: Review experiment changes

Workflow 2: Track dataset evolution

Workflow 3: Validate pipeline outputs

Workflow 4: Generate changelog

Combining with Git workflow

DVC diff works alongside Git:

Handling missing cache files

By default, files not in cache are shown:
To hide these:
Or fetch them first:

Performance considerations

Use targets - Specify --targets to diff only specific files, making the operation faster for large projects.
Compare recent commits - Comparing distant commits may be slower as DVC needs to reconstruct index state.
  • dvc status - Show current workspace status
  • dvc metrics diff - Compare metric values between commits
  • dvc params diff - Compare parameter values between commits
  • dvc plots diff - Compare and visualize plots