Git status - is there a way to show changes only in a specific directory?
From within the directory:
git status .
You can use any path really, use this syntax:
git status <directoryPath>
For instance for directory with path "my/cool/path/here"
git status my/cool/path/here
The reason that git status
takes the same options as git commit
is that the purpose of git status
is to show what would happen if you committed with the same options as you passed to git status
. In this respect git status
is really git commit --preview
.
To get what you want, you could do this which shows staged changes:
git diff --stat --cached -- <directory_of_interest>
and this, which shows unstaged changes:
git diff --stat -- <directory_of_interest>
or this which shows both:
git diff --stat HEAD -- <directory_of_interest>
Simplest solution:
- Go to the directory
git status | grep -v '\.\.\/'
Of course this discards colors.