Regarding code formatting I\'m kind of purist :). I very often remove unnecessary white spaces (lines with only ws, ws at the end of lines etc). I even have set vim to show
Use git diff -R
to turn removed lines into added lines. Then trailing whitespace will be highlighted.
(This assumes you already have whitespace hightlighting enabled, as per the colour settings from Mark's answer. Credit for this method goes to Junio's post at http://git.661346.n2.nabble.com/Highlighting-whitespace-on-removal-with-git-diff-td5653205.html .)
For example, when converting a file from DOS line endings to Unix, git diff -R
clearly shows me the ^M
characters (dis)appearing at the ends of lines. Without -R
(and also without -w
etc.) it shows that the entire file has changed, but doesn't show how.