Gitignore checker (exact git rules)
v1.0.1Is this path ignored by git, and by which .gitignore line?
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
check_ignored Is this path ignored by git?
Tells, exactly as git would (`git check-ignore -v`), whether each path is ignored by the given .gitignore rules, and which file and line decides. Handles negation (!), anchoring (/), directory-only rules (dir/), **, character classes, escapes, trailing spaces, nested .gitignore files, and the rule that nothing inside an ignored directory can be re-included. Use it before adding, moving or committing files, or when a .gitignore "does not work". No repository or file access needed: pass the .gitignore content and the paths.
| Parameter | Type | Description |
|---|---|---|
paths * | array | Paths relative to the repository root, with "/" separators. End a path with "/" if it is a directory (directory-only rules like "build/" only match directories). |
files | object | Several .gitignore files at once, as { "<path>": "<content>" }, e.g. { ".gitignore": "...", "src/.gitignore": "..." }. Paths are relative to the repository root. |
gitignore | string | Content of the root .gitignore file. |
only | string | Return all paths (default), or only the ignored ones, or only the ones git would keep. |
explain_gitignore Explain a .gitignore, line by line
Explains every rule of one or more .gitignore files in plain English (what it matches, anchored or not, directories only, re-include) and flags the classic mistakes: a "!" rule that cannot work because its parent directory is already ignored, trailing spaces, "#" not at the start of the line, "**" glued to other characters, unclosed "[", trailing backslash.
| Parameter | Type | Description |
|---|---|---|
files | object | Several .gitignore files at once, as { "<path>": "<content>" }, e.g. { ".gitignore": "...", "src/.gitignore": "..." }. Paths are relative to the repository root. |
gitignore | string | Content of the root .gitignore file. |