Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions content/docs/command-reference/check-ignore.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ patterns found in [`.dvcignore`](/doc/user-guide/dvcignore).
## Synopsis

```usage
usage: usage: dvc check-ignore [-h] [-q | -v] [-d] [-n]
usage: usage: dvc check-ignore [-h] [-q | -v] [-d] [-a] [-n] [--stdin]
targets [targets ...]

positional arguments:
Expand Down Expand Up @@ -37,6 +37,12 @@ ones that are ignored indeed are printed back.

- `-v`, `--verbose` - displays detailed tracing information.

- `--stdin` - read paths from standard input instead of providing `targets`.
Useful for interactive debugging and POSIX pipes.

- `-a`, `--all` - include all the patterns that match each target path in the
`--details` list. Has no effect without `--details`.

## Examples

First, let's create a `.dvcignore` file with some patterns in it, and some files
Expand Down Expand Up @@ -81,10 +87,39 @@ $ dvc check-ignore -d file*
.dvcignore:2:!file2 file2
```

With the `--non-matching` option, non-matching `targets` will also be included
in the list. All fields in each line, except for `<target path>`, will be empty.
By default, only the last pattern matched would be shown. To see all the
patterns matched, use `--all` (`-a`).

```dvc
$ dvc check-ignore -d -a file2
.dvcignore:1:file* file2
.dvcignore:2:!file2 file2
```

With the `--non-matching` (`-n`) option, non-matching `targets` will also be
included in the list. All fields in each line, except for `<target_path>`, will
be empty.

```dvc
$ dvc check-ignore -d -n other
:: other
```

## Example: Check paths interactively or programmatically

The `--stdin` option provides an interactive way to debug `.dvcignore` patterns:

```dvc
$ dvc check-ignore --stdin
> file1
file1
> other
> file2
file2
```

It can also be used as a component of a POSIX pipe:

```dvc
cat file_list | dvc check-ignore --stdin
```