-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
command-reference: update docs related 'update' command
- Loading branch information
Showing
2 changed files
with
16 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
||
|
@@ -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". |