{
    "content": [
        {
            "type": "text",
            "text": "# git-check-ignore(1) (man)\n\n## TLDR\n\n> Analyze and debug Git ignore/exclude (`.gitignore`) files.\n\n- Check whether a file or directory is ignored:\n  `git check-ignore {{path/to/file_or_directory}}`\n- Check whether multiple files or directories are ignored:\n  `git check-ignore {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`\n- Use pathnames, one per line, from `stdin`:\n  `git < {{path/to/file_list}} check-ignore --stdin`\n- Do not check the index (used to debug why paths were tracked and not ignored):\n  `git check-ignore --no-index {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`\n- Include details about the matching pattern for each path:\n  `git check-ignore {{-v|--verbose}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`\n\n*Source: tldr-pages*\n\n---\n\n**Summary:** git-check-ignore - Debug gitignore / exclude files\n\n**Synopsis:** git check-ignore [<options>] <pathname>...\ngit check-ignore [<options>] --stdin\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -q | --quiet | — | Don’t output anything, just set exit status. This is only valid with a single pathname. |\n| -v | --verbose | — | Instead of printing the paths that are excluded, for each path that matches an exclude pattern, print the exclude patter |\n| — | --stdin | — | Read pathnames from the standard input, one per line, instead of from the command-line. |\n| -z | — | — | The output format is modified to be machine-parsable (see below). If --stdin is also given, input paths are separated wi |\n| -n | --non-matching | — | Show given paths which don’t match any pattern. This only makes sense when --verbose is enabled, otherwise it would not  |\n| — | --no-index | — | Don’t look in the index when undertaking the checks. This can be used to debug why a path became tracked by e.g. git add |\n\n## See Also\n\n- gitignore(5)\n- git-config(1)\n- git-ls-files(1)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (4 lines)\n- **DESCRIPTION** (7 lines)\n- **OPTIONS** (1 lines) — 6 subsections\n  - -q, --quiet (2 lines)\n  - -v, --verbose (7 lines)\n  - --stdin (2 lines)\n  - -z (3 lines)\n  - -n, --non-matching (4 lines)\n  - --no-index (5 lines)\n- **OUTPUT** (33 lines)\n- **EXIT STATUS** (9 lines)\n- **SEE ALSO** (2 lines)\n- **GIT** (5 lines)\n\n## Full Content\n\n### NAME\n\ngit-check-ignore - Debug gitignore / exclude files\n\n### SYNOPSIS\n\ngit check-ignore [<options>] <pathname>...\ngit check-ignore [<options>] --stdin\n\n### DESCRIPTION\n\nFor each pathname given via the command-line or from a file via --stdin, check whether the\nfile is excluded by .gitignore (or other input files to the exclude mechanism) and output the\npath if it is excluded.\n\nBy default, tracked files are not shown at all since they are not subject to exclude rules;\nbut see ‘--no-index’.\n\n### OPTIONS\n\n#### -q, --quiet\n\nDon’t output anything, just set exit status. This is only valid with a single pathname.\n\n#### -v, --verbose\n\nInstead of printing the paths that are excluded, for each path that matches an exclude\npattern, print the exclude pattern together with the path. (Matching an exclude pattern\nusually means the path is excluded, but if the pattern begins with !  then it is a\nnegated pattern and matching it means the path is NOT excluded.)\n\nFor precedence rules within and between exclude sources, see gitignore(5).\n\n#### --stdin\n\nRead pathnames from the standard input, one per line, instead of from the command-line.\n\n#### -z\n\nThe output format is modified to be machine-parsable (see below). If --stdin is also\ngiven, input paths are separated with a NUL character instead of a linefeed character.\n\n#### -n, --non-matching\n\nShow given paths which don’t match any pattern. This only makes sense when --verbose is\nenabled, otherwise it would not be possible to distinguish between paths which match a\npattern and those which don’t.\n\n#### --no-index\n\nDon’t look in the index when undertaking the checks. This can be used to debug why a path\nbecame tracked by e.g.  git add .  and was not ignored by the rules as expected by the\nuser or when developing patterns including negation to match a path previously added with\ngit add -f.\n\n### OUTPUT\n\nBy default, any of the given pathnames which match an ignore pattern will be output, one per\nline. If no pattern matches a given path, nothing will be output for that path; this means\nthat path will not be ignored.\n\nIf --verbose is specified, the output is a series of lines of the form:\n\n<source> <COLON> <linenum> <COLON> <pattern> <HT> <pathname>\n\n<pathname> is the path of a file being queried, <pattern> is the matching pattern, <source>\nis the pattern’s source file, and <linenum> is the line number of the pattern within that\nsource. If the pattern contained a ! prefix or / suffix, it will be preserved in the output.\n<source> will be an absolute path when referring to the file configured by core.excludesFile,\nor relative to the repository root when referring to .git/info/exclude or a per-directory\nexclude file.\n\nIf -z is specified, the pathnames in the output are delimited by the null character; if\n--verbose is also specified then null characters are also used instead of colons and hard\ntabs:\n\n<source> <NULL> <linenum> <NULL> <pattern> <NULL> <pathname> <NULL>\n\nIf -n or --non-matching are specified, non-matching pathnames will also be output, in which\ncase all fields in each output record except for <pathname> will be empty. This can be useful\nwhen running non-interactively, so that files can be incrementally streamed to STDIN of a\nlong-running check-ignore process, and for each of these files, STDOUT will indicate whether\nthat file matched a pattern or not. (Without this option, it would be impossible to tell\nwhether the absence of output for a given file meant that it didn’t match any pattern, or\nthat the output hadn’t been generated yet.)\n\nBuffering happens as documented under the GITFLUSH option in git(1). The caller is\nresponsible for avoiding deadlocks caused by overfilling an input buffer or reading from an\nempty output buffer.\n\n### EXIT STATUS\n\n0\nOne or more of the provided paths is ignored.\n\n1\nNone of the provided paths are ignored.\n\n128\nA fatal error was encountered.\n\n### SEE ALSO\n\ngitignore(5) git-config(1) git-ls-files(1)\n\n### GIT\n\nPart of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                          GIT-CHECK-IGNORE(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "git-check-ignore",
        "section": "1",
        "mode": "man",
        "summary": "git-check-ignore - Debug gitignore / exclude files",
        "synopsis": "git check-ignore [<options>] <pathname>...\ngit check-ignore [<options>] --stdin",
        "tldr_summary": "Analyze and debug Git ignore/exclude (`.gitignore`) files.",
        "tldr_examples": [
            {
                "description": "Check whether a file or directory is ignored",
                "command": "git check-ignore {{path/to/file_or_directory}}"
            },
            {
                "description": "Check whether multiple files or directories are ignored",
                "command": "git check-ignore {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}"
            },
            {
                "description": "Use pathnames, one per line, from `stdin`",
                "command": "git < {{path/to/file_list}} check-ignore --stdin"
            },
            {
                "description": "Do not check the index (used to debug why paths were tracked and not ignored)",
                "command": "git check-ignore --no-index {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}"
            },
            {
                "description": "Include details about the matching pattern for each path",
                "command": "git check-ignore {{-v|--verbose}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-q",
                "long": "--quiet",
                "arg": null,
                "description": "Don’t output anything, just set exit status. This is only valid with a single pathname."
            },
            {
                "flag": "-v",
                "long": "--verbose",
                "arg": null,
                "description": "Instead of printing the paths that are excluded, for each path that matches an exclude pattern, print the exclude pattern together with the path. (Matching an exclude pattern usually means the path is excluded, but if the pattern begins with ! then it is a negated pattern and matching it means the path is NOT excluded.) For precedence rules within and between exclude sources, see gitignore(5)."
            },
            {
                "flag": "",
                "long": "--stdin",
                "arg": null,
                "description": "Read pathnames from the standard input, one per line, instead of from the command-line."
            },
            {
                "flag": "-z",
                "long": null,
                "arg": null,
                "description": "The output format is modified to be machine-parsable (see below). If --stdin is also given, input paths are separated with a NUL character instead of a linefeed character."
            },
            {
                "flag": "-n",
                "long": "--non-matching",
                "arg": null,
                "description": "Show given paths which don’t match any pattern. This only makes sense when --verbose is enabled, otherwise it would not be possible to distinguish between paths which match a pattern and those which don’t."
            },
            {
                "flag": "",
                "long": "--no-index",
                "arg": null,
                "description": "Don’t look in the index when undertaking the checks. This can be used to debug why a path became tracked by e.g. git add . and was not ignored by the rules as expected by the user or when developing patterns including negation to match a path previously added with git add -f."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "gitignore",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/gitignore/5/json"
            },
            {
                "name": "git-config",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/git-config/1/json"
            },
            {
                "name": "git-ls-files",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/git-ls-files/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-q, --quiet",
                        "lines": 2,
                        "flag": "-q",
                        "long": "--quiet"
                    },
                    {
                        "name": "-v, --verbose",
                        "lines": 7,
                        "flag": "-v",
                        "long": "--verbose"
                    },
                    {
                        "name": "--stdin",
                        "lines": 2,
                        "long": "--stdin"
                    },
                    {
                        "name": "-z",
                        "lines": 3,
                        "flag": "-z"
                    },
                    {
                        "name": "-n, --non-matching",
                        "lines": 4,
                        "flag": "-n",
                        "long": "--non-matching"
                    },
                    {
                        "name": "--no-index",
                        "lines": 5,
                        "long": "--no-index"
                    }
                ]
            },
            {
                "name": "OUTPUT",
                "lines": 33,
                "subsections": []
            },
            {
                "name": "EXIT STATUS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "GIT",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}