Synopsis
Description
Thedvc 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)
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
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).
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):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:Performance considerations
Related commands
dvc status- Show current workspace statusdvc metrics diff- Compare metric values between commitsdvc params diff- Compare parameter values between commitsdvc plots diff- Compare and visualize plots