I've found a way to count the staged files. However, I'd like to get a count of the exact opposite, i.e. to learn how many files that are in the red.
When I execute git status, I see I deleted a bunch of file. However, I'd like to know how many that is. Then, I will go git reset in the same branch and check the number of tracked files (now in green, up to date). That way, I can learn how many junky files I had in my repo that wasn't tracked.
Surprisingly, googling how to count unstaged files gave no hits, so I wonder if I'm perhaps missing something very trivial at this ungodly early hour.
The exact command to do this would be:
git ls-files --others --exclude-standard | wc -l
The --others
option will include the untracked files. --exclude-standard
option will ignore the files ignored by .gitignore
Piping to wc -l
will return a count of the output of ls-files
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