The point in removing trailing whitespace is that if everyone does it always then you end up with a diff that is minimal, ie. it consists only of code changes and not whitespace changes.
However when working with other people who do not practice this, removing all trailing whitespace with your editor or a pre-commit hook results in an even worse diff. You are doing the opposite of your intention.
So I am asking here if there is a tool that I can run manually before I commit that unstages lines from staging that are only changes in whitespace.
Also a bonus would be to change the staged line to have trailing whitespace removed for lines that have code changes.
Also a bonus would be to not do this to Markdown files (as trailing space has meaning in Markdown).
I am asking here as I fully intend to write this tool if it doesn't already exist.