Search code examples
gitversion-control

How to get git-status of a single folder in a non-recursive way (not showing its subfolders)


How can I get git-status of a single folder in a non-recursive way?

This is not a duplicate of this question since they address there how to git-status a single folder and it subdirectories, e.g. the accepted answer there is to use git status . which returns a recursive result.


Solution

  • go into the desired folder and the use:

    git status .
    

    This will display the status of the given folder which you are in right now.

    Another option is to use:

    git ls-files -t -o -m <desired path>
    

    This would display all files changed but not updated (unstaged), or untracked for the given directory.


    Non recursive way:

    In the desired folder use the combination of git status + grep to filter the results

    git status | grep -v /