How does one show untracked files in current directory only (ignoring subdirectories)?

后端 未结 3 1442
無奈伤痛
無奈伤痛 2021-02-05 20:42
git ls-files --others

goes down the directory tree. Is there an easy way to show untracked files only in the current directory?

3条回答
  •  时光取名叫无心
    2021-02-05 20:55

    Use the exclude pattern of 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 "*/*"
    

    From the man page:

    -x 
    --exclude=
    

    Skip untracked files matching pattern. Note that pattern is a shell wildcard pattern.

提交回复
热议问题