The git status command displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven't, and which files aren't being tracked by Git. Status output does not show you any information regarding the committed project history.
Porcelain Format Version 1 Version 1 porcelain format is similar to the short format, but is guaranteed not to change in a backwards-incompatible way between Git versions or based on user configuration. This makes it ideal for parsing by scripts.
It seems you have created a repo for too many folders. Make sure you create a new repo ( git init , git clone ) only in your project folder. Now everything in this folder will by tracked by git (unless you use . gitignore).
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:
git status | grep -v '\.\.\/'
Of course this discards colors.
As a note, if you simplify to check git stats without going to git directory;
### create file sudo nano /usr/local/bin/gitstat ### put this in #!/usr/bin/env bash dir=$1 if [[ $dir == "" ]]; then echo "Directory is required!" exit fi echo "Git stat for '$dir'." git --git-dir=$dir/.git --work-tree=$dir diff --stat ### give exec perm sudo chmod +x /usr/local/bin/gitstat
And calling that simple script: gitstat /path/to/foo-project
. You can also use it while in foo-project
just doing gitstat .
and so suppose shorter than git status -s
, git diff --stat
or git diff --stat HEAD
if your are always using console instead of gui's.
Credits:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With