diff --git a/website/src/docs/guide.md b/website/src/docs/guide.md index 8a06d38a3a..d5ca4622c7 100644 --- a/website/src/docs/guide.md +++ b/website/src/docs/guide.md @@ -898,6 +898,16 @@ of the running the task is considered as a generate. ::: +::: tip + +If your globs match files that are ignored by Git (build artifacts, caches, +etc.), you can set `use_gitignore: true` at the root of your Taskfile to +exclude anything matched by `.gitignore` rules from `sources` and `generates` +resolution. The setting can also be enabled or disabled per task, which takes +precedence over the root value. + +::: + ### Using programmatic checks to indicate a task is up to date Alternatively, you can inform a sequence of tests as `status`. If no error is diff --git a/website/src/docs/reference/schema.md b/website/src/docs/reference/schema.md index 40d8205caa..475c196448 100644 --- a/website/src/docs/reference/schema.md +++ b/website/src/docs/reference/schema.md @@ -208,6 +208,17 @@ set: [errexit, nounset, pipefail] shopt: [globstar] ``` +### `use_gitignore` + +- **Type**: `bool` +- **Default**: `false` +- **Description**: Exclude files matched by `.gitignore` rules when resolving + `sources` and `generates` globs for all tasks. Can be overridden per task. + +```yaml +use_gitignore: true +``` + ## Include Configuration for including external Taskfiles. @@ -624,6 +635,24 @@ tasks: - go build -o app ./cmd ``` +#### `use_gitignore` + +- **Type**: `bool` +- **Default**: `false` +- **Description**: Exclude files matched by `.gitignore` rules when resolving + this task's `sources` and `generates` globs. Overrides the root-level + `use_gitignore` setting. + +```yaml +tasks: + build: + use_gitignore: true + sources: + - '**/*.go' + cmds: + - go build ./... +``` + #### `status` - **Type**: `[]string`