summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJenna Inouye <[email protected]>2025-07-29 20:36:26 -0700
committerGitHub <[email protected]>2025-07-30 03:36:26 +0000
commit0ce89392b8d4b6a4af4eef132ac5ae6de86ac25e (patch)
tree0670749500d0bfbf0ee09b0df7b37346a3b49244 /docs
parentd5a1b717c258b3913dc41800f5a976ed9d60792a (diff)
Docs: add documentation for .geminiignore (#5123)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/gemini-ignore.md59
1 files changed, 59 insertions, 0 deletions
diff --git a/docs/gemini-ignore.md b/docs/gemini-ignore.md
new file mode 100644
index 00000000..8e8fdf20
--- /dev/null
+++ b/docs/gemini-ignore.md
@@ -0,0 +1,59 @@
+# Ignoring Files
+
+This document provides an overview of the Gemini Ignore (`.geminiignore`) feature of the Gemini CLI.
+
+The Gemini CLI includes the ability to automatically ignore files, similar to `.gitignore` (used by Git) and `.aiexclude` (used by Gemini Code Assist). Adding paths to your `.geminiignore` file will exclude them from tools that support this feature, although they will still be visible to other services (such as Git).
+
+## How it works
+
+When you add a path to your `.geminiignore` file, tools that respect this file will exclude matching files and directories from their operations. For example, when you use the [`read_many_files`](./tools/multi-file.md) command, any paths in your `.geminiignore` file will be automatically excluded.
+
+For the most part, `.geminiignore` follows the conventions of `.gitignore` files:
+
+- Blank lines and lines starting with `#` are ignored.
+- Standard glob patterns are supported (such as `*`, `?`, and `[]`).
+- Putting a `/` at the end will only match directories.
+- Putting a `/` at the beginning anchors the path relative to the `.geminiignore` file.
+- `!` negates a pattern.
+
+You can update your `.geminiignore` file at any time. To apply the changes, you must restart your Gemini CLI session.
+
+## How to use `.geminiignore`
+
+To enable `.geminiignore`:
+
+1. Create a file named `.geminiignore` in the root of your project directory.
+
+To add a file or directory to `.geminiignore`:
+
+1. Open your `.geminiignore` file.
+2. Add the path or file you want to ignore, for example: `/archive/` or `apikeys.txt`.
+
+### `.geminiignore` examples
+
+You can use `.geminiignore` to ignore directories and files:
+
+```
+# Exclude your /packages/ directory and all subdirectories
+/packages/
+
+# Exclude your apikeys.txt file
+apikeys.txt
+```
+
+You can use wildcards in your `.geminiignore` file with `*`:
+
+```
+# Exclude all .md files
+*.md
+```
+
+Finally, you can exclude files and directories from exclusion with `!`:
+
+```
+# Exclude all .md files except README.md
+*.md
+!README.md
+```
+
+To remove paths from your `.geminiignore` file, delete the relevant lines.