Return the relative path to the root directory of the DVC project.
Returns the path to the root directory of the DVC project, relative
to the current working directory.
dvc root is useful for referencing a file in
another directory when working in a subdirectory of the project.
Use this command to build fixed paths to dependencies, files, or stage
outputs. This is useful when creating shell scripts that generate
dvc.yaml files programmatically or with the
dvc stage add helper.
--help- prints the usage/help message, and exit.
--quiet- do not write anything to standard output. Exit with 0 if no problems arise, otherwise 1.
--verbose- displays detailed tracing information.
$ dvc root . $ mkdir subdir $ cd subdir $ dvc root ..
When working in a subdirectory of a DVC project, simplify file references by making all paths relative to the root directory.
$ dvc root ../../../ $ dvc stage add -d $(dvc root)/data/file.cvs ... \ python $(dvc root)/scripts/something.py
The same can be applied to non-DVC commands:
$ dvc root ../.. $ tree $(dvc root)/data/ ../../data/ ├── data.xml ├── data.xml.dvc ...