I've seen a number of solutions suggested, but nearly all of them strip whitespace from the entire file if it's been changed, which is not an option. I have also tried:
git diff -w --no-color | git apply --cached
but it doesn't seem to work either. I am using git version 1.6.3.1 and cannot update it.
Found the answer:
git diff --cached --no-color > stage.diff && git apply --index -R stage.diff && git apply --index --whitespace=fix stage.diff && rm -f stage.diff
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