diff --git a/public/static/docs/command-reference/init.md b/public/static/docs/command-reference/init.md index a00f4152844..771df82b6f2 100644 --- a/public/static/docs/command-reference/init.md +++ b/public/static/docs/command-reference/init.md @@ -3,12 +3,12 @@ This command initializes a DVC project on a directory. Note that by default the current working directory is expected to contain a Git -repository, unless the `--no-scm` option is used. +repository, unless the `--no-scm` or `--subdir` option is used. ## Synopsis ```usage -usage: dvc init [-h] [-q | -v] [--no-scm] [-f] +usage: dvc init [-h] [-q | -v] [--no-scm] [-f] [--subdir] ``` ## Description @@ -30,6 +30,9 @@ local cache and you cannot `git push` it. - `--no-scm` - skip Git specific initialization, `.dvc/.gitignore` will not be written. +- `--subdir` - initialize DVC repository in current directory and + allow to search for Git repository in parent directories + - `-f`, `--force` - remove `.dvc/` if it exists before initialization. Will remove any existing local cache. Useful when a previous `dvc init` has been corrupted. @@ -67,3 +70,28 @@ $ cat .dvc/.gitignore ... /cache ``` + +Create a new DVC repository in a subdirectory of Git repository: + +```dvc +$ mkdir repo && cd repo + +$ git init +$ mkdir subrepo && cd subrepo + +$ dvc init --subdir +``` + +In this case, Git repository is inside `repo` directory, while DVC +repository is inside `repo/subrepo`. + +```dvc +$ tree repo -a +repo +├── .git +. +. +. +└── subrepo + └── .dvc +```