Skip to content

Commit

Permalink
init: add subdir description
Browse files Browse the repository at this point in the history
  • Loading branch information
pared committed Feb 26, 2020
1 parent 6eceafa commit ecf994b
Showing 1 changed file with 39 additions and 4 deletions.
43 changes: 39 additions & 4 deletions public/static/docs/command-reference/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
This command initializes a <abbr>DVC project</abbr> 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` options are used.

## Synopsis

```usage
usage: dvc init [-h] [-q | -v] [--no-scm] [-f]
usage: dvc init [-h] [-q | -v] [--no-scm] [-f] [--subdir]
```

## Description
Expand All @@ -28,7 +28,12 @@ local cache and you cannot `git push` it.
## Options

- `--no-scm` - skip Git specific initialization, `.dvc/.gitignore` will not be
written.
written. This option should not be combined with `--subdir` (below).

- `--subdir` - allows initializing a <abbr>DVC repository</abbr> inside a
directory of a Git repo. DVC in this _subdir_ DVC repo will search for Git in
parent directories. This option should not be combined with `--no-scm`
(above).

- `-f`, `--force` - remove `.dvc/` if it exists before initialization. Will
remove any existing local cache. Useful when a previous `dvc init` has been
Expand All @@ -43,7 +48,9 @@ local cache and you cannot `git push` it.

## Examples

Create a new <abbr>DVC repository</abbr> (requires Git):
## Example: Create a new DVC repository

Requires Git.

```dvc
$ mkdir example && cd example
Expand All @@ -67,3 +74,31 @@ $ cat .dvc/.gitignore
...
/cache
```

## Example: Create a subdirectory DVC repository

Let's create a parent Git repository, and then a <abbr>DVC project</abbr> inside
a subdirectory.

```dvc
$ mkdir repo && cd repo
$ git init
$ mkdir subdir && cd subdir
$ dvc init --subdir
```

The Git repo is in the `repo/` directory, while the _subdir_ DVC repository
lives in `repo/subdir`.

```dvc
$ tree repo -a
repo
β”œβ”€β”€ .git
.
.
.
└── subdir
└── .dvc
```

0 comments on commit ecf994b

Please sign in to comment.