git-ls-files命令

该命令用于显示暂存区(index)或工作区(working tree)的文件信息

命令格式

git ls-files [-z] [-t] [-v] [-f]
(–[cached|deleted|others|ignored|stage|unmerged|killed|modified])
(-[c|d|o|i|s|u|k|m])

[–eol]
[-x <pattern>|–exclude=<pattern>]
[-X <file>|–exclude-from=<file>]
[–exclude-per-directory=<file>]
[–exclude-standard]
[–error-unmatch] [–with-tree=<tree-ish>]
[–full-name] [–recurse-submodules]
[–abbrev] [–] [<file>…​]

命令参数选项

  • -c, –cached: 显示暂存区中的文件
  • -d, –deleted: 显示删除了的文件
  • -m, –modified: 显示修改了的文件
  • -i, –ignored: 显示忽略了的文件(满足忽略模式的)
  • -o, –others: 显示其他类型的文件(如未追踪的)
  • -s, –stage: 按照如下格式显示文件内容
    [<tag\>] <mode\> <object\> <stage\> <file\>