git ls-files --others
如何在当前目录下仅显示未跟踪的文件?
ls-files
的排除模式: # on Windows, with msysgit
git ls-files --others -x */*
# on Unix (Cygwin or Ubuntu), quotes are necessary around the pattern
git ls-files --others -x "*/*"
来自man页:
-x <pattern>
--exclude=<pattern>
我不认为有一个选项可以使,但你可以直接执行以下命令:git ls-files
产生这种效果
git ls-files --other | grep -v /
...仅列出当前目录中未跟踪的文件。
git ls-files -iox "/*"
grep -v /
也是一个好答案)。请注意,模式需要用引号括起来(“* / *”)。 - Leo Alekseyev-x
仅匹配基本名称。 - Mark Longair