Here is one way:
- Start with a clean working directory (e.g.
git reset --hard ) Use Whitespace Total Fixer to clear all whitespace errors. There are options for fixing or ignoring various issues, but it might be fine by default:
find . -name "*.whatever_extension_you_need" -exec wtf.py -v -i {} \;
git diff will only show space changes now
- Scene and commit changes only as spaces.
(FWIW, I wrote wtf.py ; I'm sorry if this sounds like shameless self-promotion, but I wrote it specifically for situations like this, where the repository is repeatedly infected by spaces that cause your commits.)
You can also use wtf.py to just check for space errors, rather than fixing them in place; this will not affect your files, but it will print (hopefully useful) stderr message about the problems that he found.
> find . -name "*.whatever_extension_you_need" -exec wtf.py -v {} \; > /dev/null nightmare.txt LINE 8: WARNING: spaces followed by tabs in whitespace at beginning of line nightmare.txt: CHOPPED 1 lines with trailing space CHOPPED 0 blank lines at EOF ADDED newline at EOF CHANGED 1 line endings which didn't match crlf from first line WARNED ABOUT 1 lines with tabs/spaces mix
Dan lenski
source share