开发者

How to make git enable whitespace diff while doing git add

开发者 https://www.devze.com 2023-03-06 04:58 出处:网络
I ran following command on my project to remove trailing whitespaces. find . -name \'*.rb\' | xargs perl -pi -e \'s/ +$//\'

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 l开发者_开发问答ine 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消