• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

dvc diff: Show changes in DVC tracked file and directories

by admin

The dvc diff command is used in DVC (Data Version Control) to show the changes made to DVC tracked files and directories. It helps you compare the differences between different versions of your data and understand the modifications that have occurred.

Here is a more detailed explanation of the dvc diff command:

  • Tracking Changes: DVC allows you to track your data files and directories using its version control system. When you make changes to these tracked files, such as modifying, adding, or removing files, DVC keeps track of these changes.
  • DVC Commit: Before running dvc diff, it’s important to understand that DVC operates on a commit-based system. Whenever you make changes to your data files, you need to commit those changes using dvc commit. This step ensures that DVC records the modifications and assigns a unique identifier (commit hash) to the new version of the data.
  • Comparing Versions: Once you have committed your changes, you can use the dvc diff command to compare different versions of your data. By default, dvc diff compares the currently checked-out version of the data with the previous committed version.
  • Output Format: When you run dvc diff, it generates a summary of the changes. It provides information about added files, removed files, modified files, and directories. It also includes the sizes of added and removed files, helping you identify the impact of the changes on your data storage.
  • Context: dvc diff provides additional context for file changes. For modified files, it shows the line-by-line differences, highlighting the specific changes that were made.
  • Options: The dvc diff command provides options to compare different versions of your data. You can specify a particular commit hash, a branch, or a tag to compare against the currently checked-out version.

Here is an example usage of dvc diff:

$ dvc diff
M       data/file.txt
A       data/new_file.txt
D       data/old_file.txt

In this example, the output indicates that the file file.txt was modified (M), new_file.txt was added (A), and old_file.txt was removed (D).

By using dvc diff, you can effectively track and understand the changes made to your data files, helping you maintain a clear history of modifications and facilitating collaboration among team members.

dvc diff Command Examples

1. Compare DVC tracked files from different Git commits, tags, and branches w.r.t the current workspace:

# dvc diff commit_hash/tag/branch

2. Compare the changes in DVC tracked files from 1 Git commit to another:

# dvc diff revision_b revision_a

3. Compare DVC tracked files, along with their latest hash:

# dvc diff --show-hash commit

4. Compare DVC tracked files, displaying the output as JSON:

# dvc diff --show-json --show-hash commit

5. Compare DVC tracked files, displaying the output as Markdown:

# dvc diff --show-md --show-hash commit

Filed Under: Linux

Some more articles you might also be interested in …

  1. size Command Examples in Linux
  2. “az logout” Command Examples (Log out from an Azure subscription)
  3. ccomps: Decompose graphs into their connected components
  4. dir Command Examples in Linux
  5. How to configure apache virtual host on ubuntu
  6. How to Schedule Tasks Using at in Linux
  7. minifab Command Examples
  8. logwatch : command not found
  9. ipcmk Command Examples in Linux
  10. emerge Command Examples in Gentoo Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright