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

前端 未结 4 936
灰色年华
灰色年华 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 07:48

    You can use:

    git status | grep -v /
    

    to filter out any paths that contain a slash (/) which means they are in subdirectories.

    You will also lose the red/green coloring of the changed paths.

    Update:

    This solution does not display the files that are moved from or to the current directory because the source and destination of a move operation are displayed on the same line in the output. The files that were renamed in the current directory (without being moved between directories) are displayed though.

提交回复
热议问题