Skip to content

Commit

Permalink
command-reference: update docs related 'update' command
Browse files Browse the repository at this point in the history
  • Loading branch information
ilgooz committed Jan 4, 2020
1 parent 99bd5b9 commit 82c8b5c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 28 deletions.
19 changes: 2 additions & 17 deletions static/docs/command-reference/import.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,8 @@ deps:

If the
[Git revision](https://git-scm.com/book/en/v2/Git-Internals-Git-References)
moves (e.g. a branch), you may use `dvc update` to bring the data up to date.
However, for typically static references (e.g. tags), or for SHA commits, in
order to actually "update" an import, it's necessary to **re-import the data**
instead, by using `dvc import` again without or with a different `--rev`. This
will overwrite the import stage (DVC-file), either removing or replacing the
`rev` field, respectively. This can produce an import stage that is able to be
updated normally with `dvc update` going forward. For example:

```dvc
$ dvc import --rev master \
[email protected]:iterative/dataset-registry.git \
use-cases/cats-dogs
```

> In the above example, the value for `rev` in the new import stage will be
> `master`, which happens to be the default branch in this Git repository, so
> the command is equivalent to not using `--rev` at all.
moves (e.g. a branch), you may use `dvc update` preferably with `--rev` option
to bring the data up to date. Using `--rev` also updates the fixed-revision.

## Example: Data registry

Expand Down
25 changes: 14 additions & 11 deletions static/docs/command-reference/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,15 @@ Note that import stages are considered always locked, meaning that if you run
`dvc repro`, they won't be updated. `dvc update` is the only command that can
update them.

Another detail to note is that when the `--rev` (revision) option of
`dvc import` has been used to create an import stage, DVC is not aware of what
kind of
[Git revision](https://git-scm.com/book/en/v2/Git-Internals-Git-References) this
is, for example a branch or a tag. For typically static references (e.g. tags),
or for SHA commits, `dvc update` will not have any effect on the import. Refer
to the
[re-importing example](/doc/command-reference/import#example-fixed-revisions-re-importing)
to learn how to "update" fixed-revision imports.
To "update" fixed-revision to static references (e.g. tags), or for SHA commits,
use `dvc update` with the `--rev` option.

## Options

- `--rev` - specific
[Git revision](https://git-scm.com/book/en/v2/Git-Internals-Git-References)
(such as a branch name, a tag, or a commit hash) of the DVC repository to
update the data from. Repository's revision formed by the first import is used
by default when this option is not specified.
update the data from. Using this option also updates the fixed-revision.

- `-h`, `--help` - prints the usage/help message, and exit.

Expand Down Expand Up @@ -81,3 +73,14 @@ stable.
> Note that `dvc update` updates the `rev_lock` field of the corresponding
> [DVC-file](/doc/user-guide/dvc-file-format) (when there are changes to bring
> in).
To update from and also lock to a specific revision of a <abbr>data
artifact</abbr>, we may use the `--rev` option this time:

```dvc
$ dvc update --rev v2 model.pkl.dvc
Importing 'model.pkl ([email protected]:iterative/example-get-started)'
-> 'model.pkl'
```

Since the source files has changed, we see the results of our "update".

0 comments on commit 82c8b5c

Please sign in to comment.