For a Git script I'm writing, I'd like to have a programmatic way to check whether there is anything at all staged. i.e. I want a positive result if anything at all is staged, and negative if nothing is staged.
Bonus points: A way to programmatically check whether there is anything new in the working tree that can be staged.
You're looking for:
git diff --cached --quiet
--exit-code if you still want output)