2

I ran following command on my project to remove trailing whitespaces.

find . -name '*.rb' | xargs perl -pi -e 's/ +$//'

It worked however when I do

git add -p

I see that one line has been deleted and the same line being added. I do not see any visual indicator that a trailing whitespace has been removed. I am not sure if it is relevant but I have following setting on my .gitconfig

[apply]
    whitespace = nowarn

While doing git add -p what extra parameter I should pass to see a visual indicator that a trailing whitespace has been deleted?

Nick Vanderbilt
  • 36,724
  • 29
  • 83
  • 106
  • My question is similar to http://stackoverflow.com/questions/3920650/git-diff-show-me-line-ending-changes – Nick Vanderbilt May 13 '11 at 14:35
  • 1
    I think this is also essentially the same problem as this question - I'm afraid I don't have any better idea than then, though: http://stackoverflow.com/questions/5257553/coloring-white-space-in-git-diffs-output – Mark Longair May 13 '11 at 15:14

1 Answers1

1

You may be able to see it using a graphical tool, such as gvimdiff. Try using "git difftool".

And as far as I can tell, the default behaviour for git is to show trailing whitespace highlighted in red, only in lines you ADD, not those being taken away.

Infiltrator
  • 1,611
  • 1
  • 16
  • 25