Based on this vimcast I changed my .vimrc file.
http://vimcasts.org/episodes/tidying-whitespace#highlighter_963342
Now every single time I touch a file that file has a number of changes related to trailing whitespaces. In one single sweep I want to remove all the trailing whitespaces.
It is trickier though.
Make sure that you don't remove end of line character. vim code takes care of that.
if a line does not have trailing whitespace then that line should not be marked as ch开发者_运维技巧anged by git.
I'm having a hard time interpreting your question -- not sure where git enters in -- but assuming you're looking for a shell command to remove trailing whitespace from each line:
sed 's/[[:space:]]\+$//'
To visually confirm that it's removing whitespace:
cat -E afile
sed 's/[[:space:]]\+//' afile | cat -E
git config --global apply.whitespace nowarn
http://help.github.com/git-cheat-sheets/
精彩评论