# Config : ignorefiles
**Reference:** [ [gitignore](https://git-scm.com/docs/gitignore/en) | [dockerignore](https://docs.docker.com/build/concepts/context/#dockerignore-files) | [gcloudignore](https://cloud.google.com/sdk/gcloud/reference/topic/gcloudignore) ]
## .gitignore
```
# comments must start at the beginning of line
# empty lines are ignored; trailing spaces are ignored
foo # matches file or dir named "foo" at any lavel
/foo # matches file or dir named "foo" at root level
foo/ # matches directories named "foo" at any level
foo/bar # if there's a slash in the middle of the pattern,
# it only matches relative to .gitignore (as if /foo/bar")
**/foo/bar # matches "foo/bar" at any level
!foo # use negated patterns to re-include files that were excluded above
? # matches any char but "/"
* # matches anything but "/"
[a-zA-Z] # custom character classes
/**/ # matches arbitrary path: "foo/**/bar" matches "foo/bar", "foo/hey/bar", etc
```
## .dockerignore
Excludes files from the build context.
```
# comments must start at the beginning of line
# patterns are relative to build context
# leading and trailing slahes are ignored
# more or less follows Unix globbing patterns
*/temp* # Exclude files and directories whose names start with `temp` in any immediate subdirectory of the root.
*/*/temp* # Exclude files and directories starting with `temp` from any subdirectory that is two levels below the root.
temp? # Exclude files and directories in the root directory whose names are a one-character extension of `temp`.
**/*.go # Exclude all files that end with `.go` found anywhere in the build context.
!PATTERN # Re-include file(s) using negated pattern.
```
#### Multiple Files
If you want to have multiple Dockerfiles in the same directory, each with it's own `.dockerignore` file, you can name it after the Dockerfile:
```
Dockerfile1
Dockerfile1.dockerignore
...
```
## .gcloudignore
For commands in `[gcloud](https://cloud.google.com/sdk/gcloud/reference)` that involve uploading the contents of a directory to Google Cloud to host or build, such as `gcloud builds submit`, will exclude files from that upload.
```
# comments must start at the beginning of line
# empty lines are ignored
foo # any file named "foo", anywhere
foo/ # any dir named "foo", anywhere
/bar # a file named "bar" in the root
foo* # any file starting with "foo"
*bar # any file ending with "bar"
baz*qux # any file starting with "baz" and ending with "qux"
!PATTERN # re-include file(s) with negated pattern
```
Default (auto-generated) `.gcloudignore`:
```
.gcloudignore
.git
.gitignore
```