{
    "content": [
        {
            "type": "text",
            "text": "# git-ls-files(1) (man)\n\n## TLDR\n\n> Show information about files in the index and the working tree.\n\n- Show deleted files:\n  `git ls-files {{-d|--deleted}}`\n- Show modified and deleted files:\n  `git ls-files {{-m|--modified}}`\n- Show ignored and untracked files:\n  `git ls-files {{-o|--others}}`\n- Show untracked files, not ignored:\n  `git ls-files {{-o|--others}} --exclude-standard`\n\n*Source: tldr-pages*\n\n---\n\n**Summary:** git-ls-files - Show information about files in the index and the working tree\n\n**Synopsis:** git ls-files [-z] [-t] [-v] [-f]\n(--[cached|deleted|others|ignored|stage|unmerged|killed|modified])*\n(-[c|d|o|i|s|u|k|m])*\n[--eol]\n[--deduplicate]\n[-x <pattern>|--exclude=<pattern>]\n[-X <file>|--exclude-from=<file>]\n[--exclude-per-directory=<file>]\n[--exclude-standard]\n[--error-unmatch] [--with-tree=<tree-ish>]\n[--full-name] [--recurse-submodules]\n[--abbrev[=<n>]] [--] [<file>...]\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -c | --cached | — | Show cached files in the output (default) |\n| -d | --deleted | — | Show deleted files in the output |\n| -m | --modified | — | Show modified files in the output |\n| -o | --others | — | Show other (i.e. untracked) files in the output |\n| -i | --ignored | — | Show only ignored files in the output. When showing files in the index, print only those matched by an exclude pattern.  |\n| -s | --stage | — | Show staged contents' mode bits, object name and stage number in the output. |\n| — | --directory | — | If a whole directory is classified as \"other\", show just its name (with a trailing slash) and not its whole contents. |\n| — | --no-empty-directory | — | Do not list empty directories. Has no effect without --directory. |\n| -u | --unmerged | — | Show unmerged files in the output (forces --stage) |\n| -k | --killed | — | Show files on the filesystem that need to be removed due to file/directory conflicts for checkout-index to succeed. |\n| -z | — | — | \\0 line termination on output and do not quote filenames. See OUTPUT below for more information. |\n| — | --deduplicate | — | When only filenames are shown, suppress duplicates that may come from having multiple stages during a merge, or giving - |\n| — | --exclude-standard | — | Add the standard Git exclusions: .git/info/exclude, .gitignore in each directory, and the user’s global exclusion file. |\n| — | --error-unmatch | — | If any <file> does not appear in the index, treat this as an error (return 1). --with-tree=<tree-ish> When using --error |\n| -t | — | — | This feature is semi-deprecated. For scripting purpose, git-status(1) --porcelain and git-diff-files(1) --name-status ar |\n| -v | — | — | Similar to -t, but use lowercase letters for files that are marked as assume unchanged (see git-update-index(1)). |\n| -f | — | — | Similar to -t, but use lowercase letters for files that are marked as fsmonitor valid (see git-update-index(1)). |\n| — | --full-name | — | When run from a subdirectory, the command usually outputs paths relative to the current directory. This option forces pa |\n| — | --recurse-submodules | — | Recursively calls ls-files on each active submodule in the repository. Currently there is only support for the --cached  |\n| — | --debug | — | After each line that describes a file, add more data about its cache entry. This is intended to show as much information |\n| — | --eol | — | Show <eolinfo> and <eolattr> of files. <eolinfo> is the file content identification used by Git when the \"text\" attribut |\n\n## See Also\n\n- git-read-tree(1)\n- gitignore(5)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (14 lines)\n- **DESCRIPTION** (5 lines)\n- **OPTIONS** (1 lines) — 21 subsections\n  - -c, --cached (2 lines)\n  - -d, --deleted (2 lines)\n  - -m, --modified (2 lines)\n  - -o, --others (2 lines)\n  - -i, --ignored (5 lines)\n  - -s, --stage (2 lines)\n  - --directory (3 lines)\n  - --no-empty-directory (2 lines)\n  - -u, --unmerged (2 lines)\n  - -k, --killed (3 lines)\n  - -z (3 lines)\n  - --deduplicate (15 lines)\n  - --exclude-standard (3 lines)\n  - --error-unmatch (8 lines)\n  - -t (29 lines)\n  - -v (3 lines)\n  - -f (3 lines)\n  - --full-name (3 lines)\n  - --recurse-submodules (8 lines)\n  - --debug (4 lines)\n  - --eol (21 lines)\n- **OUTPUT** (19 lines)\n- **EXCLUDE PATTERNS** (21 lines)\n- **SEE ALSO** (2 lines)\n- **GIT** (5 lines)\n\n## Full Content\n\n### NAME\n\ngit-ls-files - Show information about files in the index and the working tree\n\n### SYNOPSIS\n\ngit ls-files [-z] [-t] [-v] [-f]\n(--[cached|deleted|others|ignored|stage|unmerged|killed|modified])*\n(-[c|d|o|i|s|u|k|m])*\n[--eol]\n[--deduplicate]\n[-x <pattern>|--exclude=<pattern>]\n[-X <file>|--exclude-from=<file>]\n[--exclude-per-directory=<file>]\n[--exclude-standard]\n[--error-unmatch] [--with-tree=<tree-ish>]\n[--full-name] [--recurse-submodules]\n[--abbrev[=<n>]] [--] [<file>...]\n\n### DESCRIPTION\n\nThis merges the file listing in the index with the actual working directory list, and shows\ndifferent combinations of the two.\n\nOne or more of the options below may be used to determine the files shown:\n\n### OPTIONS\n\n#### -c, --cached\n\nShow cached files in the output (default)\n\n#### -d, --deleted\n\nShow deleted files in the output\n\n#### -m, --modified\n\nShow modified files in the output\n\n#### -o, --others\n\nShow other (i.e. untracked) files in the output\n\n#### -i, --ignored\n\nShow only ignored files in the output. When showing files in the index, print only those\nmatched by an exclude pattern. When showing \"other\" files, show only those matched by an\nexclude pattern. Standard ignore rules are not automatically activated, therefore at\nleast one of the --exclude* options is required.\n\n#### -s, --stage\n\nShow staged contents' mode bits, object name and stage number in the output.\n\n#### --directory\n\nIf a whole directory is classified as \"other\", show just its name (with a trailing slash)\nand not its whole contents.\n\n#### --no-empty-directory\n\nDo not list empty directories. Has no effect without --directory.\n\n#### -u, --unmerged\n\nShow unmerged files in the output (forces --stage)\n\n#### -k, --killed\n\nShow files on the filesystem that need to be removed due to file/directory conflicts for\ncheckout-index to succeed.\n\n#### -z\n\n\\0 line termination on output and do not quote filenames. See OUTPUT below for more\ninformation.\n\n#### --deduplicate\n\nWhen only filenames are shown, suppress duplicates that may come from having multiple\nstages during a merge, or giving --deleted and --modified option at the same time. When\nany of the -t, --unmerged, or --stage option is in use, this option has no effect.\n\n-x <pattern>, --exclude=<pattern>\nSkip untracked files matching pattern. Note that pattern is a shell wildcard pattern. See\nEXCLUDE PATTERNS below for more information.\n\n-X <file>, --exclude-from=<file>\nRead exclude patterns from <file>; 1 per line.\n\n--exclude-per-directory=<file>\nRead additional exclude patterns that apply only to the directory and its subdirectories\nin <file>.\n\n#### --exclude-standard\n\nAdd the standard Git exclusions: .git/info/exclude, .gitignore in each directory, and the\nuser’s global exclusion file.\n\n#### --error-unmatch\n\nIf any <file> does not appear in the index, treat this as an error (return 1).\n\n--with-tree=<tree-ish>\nWhen using --error-unmatch to expand the user supplied <file> (i.e. path pattern)\narguments to paths, pretend that paths which were removed in the index since the named\n<tree-ish> are still present. Using this option with -s or -u options does not make any\nsense.\n\n#### -t\n\nThis feature is semi-deprecated. For scripting purpose, git-status(1) --porcelain and\ngit-diff-files(1) --name-status are almost always superior alternatives, and users should\nlook at git-status(1) --short or git-diff(1) --name-status for more user-friendly\nalternatives.\n\nThis option identifies the file status with the following tags (followed by a space) at\nthe start of each line:\n\nH\ncached\n\nS\nskip-worktree\n\nM\nunmerged\n\nR\nremoved/deleted\n\nC\nmodified/changed\n\nK\nto be killed\n\n?\nother\n\n#### -v\n\nSimilar to -t, but use lowercase letters for files that are marked as assume unchanged\n(see git-update-index(1)).\n\n#### -f\n\nSimilar to -t, but use lowercase letters for files that are marked as fsmonitor valid\n(see git-update-index(1)).\n\n#### --full-name\n\nWhen run from a subdirectory, the command usually outputs paths relative to the current\ndirectory. This option forces paths to be output relative to the project top directory.\n\n#### --recurse-submodules\n\nRecursively calls ls-files on each active submodule in the repository. Currently there is\nonly support for the --cached mode.\n\n--abbrev[=<n>]\nInstead of showing the full 40-byte hexadecimal object lines, show the shortest prefix\nthat is at least <n> hexdigits long that uniquely refers the object. Non default number\nof digits can be specified with --abbrev=<n>.\n\n#### --debug\n\nAfter each line that describes a file, add more data about its cache entry. This is\nintended to show as much information as possible for manual inspection; the exact format\nmay change at any time.\n\n#### --eol\n\nShow <eolinfo> and <eolattr> of files. <eolinfo> is the file content identification used\nby Git when the \"text\" attribute is \"auto\" (or not set and core.autocrlf is not false).\n<eolinfo> is either \"-text\", \"none\", \"lf\", \"crlf\", \"mixed\" or \"\".\n\n\"\" means the file is not a regular file, it is not in the index or not accessible in the\nworking tree.\n\n<eolattr> is the attribute that is used when checking out or committing, it is either \"\",\n\"-text\", \"text\", \"text=auto\", \"text eol=lf\", \"text eol=crlf\". Since Git 2.10 \"text=auto\neol=lf\" and \"text=auto eol=crlf\" are supported.\n\nBoth the <eolinfo> in the index (\"i/<eolinfo>\") and in the working tree (\"w/<eolinfo>\")\nare shown for regular files, followed by the (\"attr/<eolattr>\").\n\n--\nDo not interpret any more arguments as options.\n\n<file>\nFiles to show. If no files are given all files which match the other specified criteria\nare shown.\n\n### OUTPUT\n\ngit ls-files just outputs the filenames unless --stage is specified in which case it outputs:\n\n[<tag> ]<mode> <object> <stage> <file>\n\ngit ls-files --eol will show\ni/<eolinfo><SPACES>w/<eolinfo><SPACES>attr/<eolattr><SPACE*><TAB><file>\n\ngit ls-files --unmerged and git ls-files --stage can be used to examine detailed information\non unmerged paths.\n\nFor an unmerged path, instead of recording a single mode/SHA-1 pair, the index records up to\nthree such pairs; one from tree O in stage 1, A in stage 2, and B in stage 3. This\ninformation can be used by the user (or the porcelain) to see what should eventually be\nrecorded at the path. (see git-read-tree(1) for more information on state)\n\nWithout the -z option, pathnames with \"unusual\" characters are quoted as explained for the\nconfiguration variable core.quotePath (see git-config(1)). Using -z the filename is output\nverbatim and the line is terminated by a NUL byte.\n\n### EXCLUDE PATTERNS\n\ngit ls-files can use a list of \"exclude patterns\" when traversing the directory tree and\nfinding files to show when the flags --others or --ignored are specified. gitignore(5)\nspecifies the format of exclude patterns.\n\nThese exclude patterns come from these places, in order:\n\n1. The command-line flag --exclude=<pattern> specifies a single pattern. Patterns are\nordered in the same order they appear in the command line.\n\n2. The command-line flag --exclude-from=<file> specifies a file containing a list of\npatterns. Patterns are ordered in the same order they appear in the file.\n\n3. The command-line flag --exclude-per-directory=<name> specifies a name of the file in each\ndirectory git ls-files examines, normally .gitignore. Files in deeper directories take\nprecedence. Patterns are ordered in the same order they appear in the files.\n\nA pattern specified on the command line with --exclude or read from the file specified with\n--exclude-from is relative to the top of the directory tree. A pattern read from a file\nspecified by --exclude-per-directory is relative to the directory that the pattern file\nappears in.\n\n### SEE ALSO\n\ngit-read-tree(1), gitignore(5)\n\n### GIT\n\nPart of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                              GIT-LS-FILES(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "git-ls-files",
        "section": "1",
        "mode": "man",
        "summary": "git-ls-files - Show information about files in the index and the working tree",
        "synopsis": "git ls-files [-z] [-t] [-v] [-f]\n(--[cached|deleted|others|ignored|stage|unmerged|killed|modified])*\n(-[c|d|o|i|s|u|k|m])*\n[--eol]\n[--deduplicate]\n[-x <pattern>|--exclude=<pattern>]\n[-X <file>|--exclude-from=<file>]\n[--exclude-per-directory=<file>]\n[--exclude-standard]\n[--error-unmatch] [--with-tree=<tree-ish>]\n[--full-name] [--recurse-submodules]\n[--abbrev[=<n>]] [--] [<file>...]",
        "tldr_summary": "Show information about files in the index and the working tree.",
        "tldr_examples": [
            {
                "description": "Show deleted files",
                "command": "git ls-files {{-d|--deleted}}"
            },
            {
                "description": "Show modified and deleted files",
                "command": "git ls-files {{-m|--modified}}"
            },
            {
                "description": "Show ignored and untracked files",
                "command": "git ls-files {{-o|--others}}"
            },
            {
                "description": "Show untracked files, not ignored",
                "command": "git ls-files {{-o|--others}} --exclude-standard"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-c",
                "long": "--cached",
                "arg": null,
                "description": "Show cached files in the output (default)"
            },
            {
                "flag": "-d",
                "long": "--deleted",
                "arg": null,
                "description": "Show deleted files in the output"
            },
            {
                "flag": "-m",
                "long": "--modified",
                "arg": null,
                "description": "Show modified files in the output"
            },
            {
                "flag": "-o",
                "long": "--others",
                "arg": null,
                "description": "Show other (i.e. untracked) files in the output"
            },
            {
                "flag": "-i",
                "long": "--ignored",
                "arg": null,
                "description": "Show only ignored files in the output. When showing files in the index, print only those matched by an exclude pattern. When showing \"other\" files, show only those matched by an exclude pattern. Standard ignore rules are not automatically activated, therefore at least one of the --exclude* options is required."
            },
            {
                "flag": "-s",
                "long": "--stage",
                "arg": null,
                "description": "Show staged contents' mode bits, object name and stage number in the output."
            },
            {
                "flag": "",
                "long": "--directory",
                "arg": null,
                "description": "If a whole directory is classified as \"other\", show just its name (with a trailing slash) and not its whole contents."
            },
            {
                "flag": "",
                "long": "--no-empty-directory",
                "arg": null,
                "description": "Do not list empty directories. Has no effect without --directory."
            },
            {
                "flag": "-u",
                "long": "--unmerged",
                "arg": null,
                "description": "Show unmerged files in the output (forces --stage)"
            },
            {
                "flag": "-k",
                "long": "--killed",
                "arg": null,
                "description": "Show files on the filesystem that need to be removed due to file/directory conflicts for checkout-index to succeed."
            },
            {
                "flag": "-z",
                "long": null,
                "arg": null,
                "description": "\\0 line termination on output and do not quote filenames. See OUTPUT below for more information."
            },
            {
                "flag": "",
                "long": "--deduplicate",
                "arg": null,
                "description": "When only filenames are shown, suppress duplicates that may come from having multiple stages during a merge, or giving --deleted and --modified option at the same time. When any of the -t, --unmerged, or --stage option is in use, this option has no effect. -x <pattern>, --exclude=<pattern> Skip untracked files matching pattern. Note that pattern is a shell wildcard pattern. See EXCLUDE PATTERNS below for more information. -X <file>, --exclude-from=<file> Read exclude patterns from <file>; 1 per line. --exclude-per-directory=<file> Read additional exclude patterns that apply only to the directory and its subdirectories in <file>."
            },
            {
                "flag": "",
                "long": "--exclude-standard",
                "arg": null,
                "description": "Add the standard Git exclusions: .git/info/exclude, .gitignore in each directory, and the user’s global exclusion file."
            },
            {
                "flag": "",
                "long": "--error-unmatch",
                "arg": null,
                "description": "If any <file> does not appear in the index, treat this as an error (return 1). --with-tree=<tree-ish> When using --error-unmatch to expand the user supplied <file> (i.e. path pattern) arguments to paths, pretend that paths which were removed in the index since the named <tree-ish> are still present. Using this option with -s or -u options does not make any sense."
            },
            {
                "flag": "-t",
                "long": null,
                "arg": null,
                "description": "This feature is semi-deprecated. For scripting purpose, git-status(1) --porcelain and git-diff-files(1) --name-status are almost always superior alternatives, and users should look at git-status(1) --short or git-diff(1) --name-status for more user-friendly alternatives. This option identifies the file status with the following tags (followed by a space) at the start of each line: H cached S skip-worktree M unmerged R removed/deleted C modified/changed K to be killed ? other"
            },
            {
                "flag": "-v",
                "long": null,
                "arg": null,
                "description": "Similar to -t, but use lowercase letters for files that are marked as assume unchanged (see git-update-index(1))."
            },
            {
                "flag": "-f",
                "long": null,
                "arg": null,
                "description": "Similar to -t, but use lowercase letters for files that are marked as fsmonitor valid (see git-update-index(1))."
            },
            {
                "flag": "",
                "long": "--full-name",
                "arg": null,
                "description": "When run from a subdirectory, the command usually outputs paths relative to the current directory. This option forces paths to be output relative to the project top directory."
            },
            {
                "flag": "",
                "long": "--recurse-submodules",
                "arg": null,
                "description": "Recursively calls ls-files on each active submodule in the repository. Currently there is only support for the --cached mode. --abbrev[=<n>] Instead of showing the full 40-byte hexadecimal object lines, show the shortest prefix that is at least <n> hexdigits long that uniquely refers the object. Non default number of digits can be specified with --abbrev=<n>."
            },
            {
                "flag": "",
                "long": "--debug",
                "arg": null,
                "description": "After each line that describes a file, add more data about its cache entry. This is intended to show as much information as possible for manual inspection; the exact format may change at any time."
            },
            {
                "flag": "",
                "long": "--eol",
                "arg": null,
                "description": "Show <eolinfo> and <eolattr> of files. <eolinfo> is the file content identification used by Git when the \"text\" attribute is \"auto\" (or not set and core.autocrlf is not false). <eolinfo> is either \"-text\", \"none\", \"lf\", \"crlf\", \"mixed\" or \"\". \"\" means the file is not a regular file, it is not in the index or not accessible in the working tree. <eolattr> is the attribute that is used when checking out or committing, it is either \"\", \"-text\", \"text\", \"text=auto\", \"text eol=lf\", \"text eol=crlf\". Since Git 2.10 \"text=auto eol=lf\" and \"text=auto eol=crlf\" are supported. Both the <eolinfo> in the index (\"i/<eolinfo>\") and in the working tree (\"w/<eolinfo>\") are shown for regular files, followed by the (\"attr/<eolattr>\"). -- Do not interpret any more arguments as options. <file> Files to show. If no files are given all files which match the other specified criteria are shown."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "git-read-tree",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/git-read-tree/1/json"
            },
            {
                "name": "gitignore",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/gitignore/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-c, --cached",
                        "lines": 2,
                        "flag": "-c",
                        "long": "--cached"
                    },
                    {
                        "name": "-d, --deleted",
                        "lines": 2,
                        "flag": "-d",
                        "long": "--deleted"
                    },
                    {
                        "name": "-m, --modified",
                        "lines": 2,
                        "flag": "-m",
                        "long": "--modified"
                    },
                    {
                        "name": "-o, --others",
                        "lines": 2,
                        "flag": "-o",
                        "long": "--others"
                    },
                    {
                        "name": "-i, --ignored",
                        "lines": 5,
                        "flag": "-i",
                        "long": "--ignored"
                    },
                    {
                        "name": "-s, --stage",
                        "lines": 2,
                        "flag": "-s",
                        "long": "--stage"
                    },
                    {
                        "name": "--directory",
                        "lines": 3,
                        "long": "--directory"
                    },
                    {
                        "name": "--no-empty-directory",
                        "lines": 2,
                        "long": "--no-empty-directory"
                    },
                    {
                        "name": "-u, --unmerged",
                        "lines": 2,
                        "flag": "-u",
                        "long": "--unmerged"
                    },
                    {
                        "name": "-k, --killed",
                        "lines": 3,
                        "flag": "-k",
                        "long": "--killed"
                    },
                    {
                        "name": "-z",
                        "lines": 3,
                        "flag": "-z"
                    },
                    {
                        "name": "--deduplicate",
                        "lines": 15,
                        "long": "--deduplicate"
                    },
                    {
                        "name": "--exclude-standard",
                        "lines": 3,
                        "long": "--exclude-standard"
                    },
                    {
                        "name": "--error-unmatch",
                        "lines": 8,
                        "long": "--error-unmatch"
                    },
                    {
                        "name": "-t",
                        "lines": 29,
                        "flag": "-t"
                    },
                    {
                        "name": "-v",
                        "lines": 3,
                        "flag": "-v"
                    },
                    {
                        "name": "-f",
                        "lines": 3,
                        "flag": "-f"
                    },
                    {
                        "name": "--full-name",
                        "lines": 3,
                        "long": "--full-name"
                    },
                    {
                        "name": "--recurse-submodules",
                        "lines": 8,
                        "long": "--recurse-submodules"
                    },
                    {
                        "name": "--debug",
                        "lines": 4,
                        "long": "--debug"
                    },
                    {
                        "name": "--eol",
                        "lines": 21,
                        "long": "--eol"
                    }
                ]
            },
            {
                "name": "OUTPUT",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "EXCLUDE PATTERNS",
                "lines": 21,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "GIT",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}