Is there a command/option/filter to discard the changes (via a checkout) on all the modified files whose changes only affect whitespace?
Alternatively, staging only files with non-whitespace changes (including staging their whitespace changes) would be fine.
You could:
first apply all non-whitespace changes (see "Git add only non-whitespace changes")
git diff -w --no-color | git apply --cached --ignore-whitespace
clean any other changes (see "How do you discard unstaged changes in git?")
git checkout -- .
In this solution, the order is important.
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