Reputation: 123
I need to check the git status and find all files which is not ".txt" format.
I know how to find all files which is in this format:
$TextFiles = $(git status --short *.txt --porcelain | Measure-Object | Select-Object -expand Count)
How can I do the same but to retrieve all other files with NO text format??
I've tried this way but it didn't work...
$NoTextFiles = $(git status --short -ne *.txt --porcelain | Measure-Object | Select-Object -expand Count)
Upvotes: 0
Views: 148
Reputation: 151
You can use :!
for your git pathspec (see gitglossary for more info)
git status --short ':!*.txt'
But when you have staged entire directories this command will only list the directory name not its content.
If you want to list every file that is not *.txt you should do this with powershell:
git status --short '*.*' | Where-Object { $_ -notmatch ".*\.txt"}
Upvotes: 1