How can I restrict git status to regular files in the current directory only?

前端 未结 4 945
灰色年华
灰色年华 2021-02-05 07:28

I would like to see the status of the current directory. Because there are lots of changes in sub-directories, which I do not want to see, the following command doesn\'

4条回答
  •  情深已故
    2021-02-05 08:08

    Maybe there's a more proper way to do this, but you can simply

    find . -maxdepth 1 -type f -print0 | xargs -0 git status
    

    Of course, this fails if there's no regular files on the current directory. In that case, you can use the extra ugly version

    find . -maxdepth 1 -type f -print0 | xargs -0 git status nonexistentfile
    

    And, no, I'm not going to address the case where you have a file named nonexistentfile.

提交回复
热议问题