git, whitespace errors, squelching and autocrlf, the definitive answers

Squelching is initially a function used in telecommunication to set a threshold above which a signal is or isn't alllowed through.

In your case, when you see:

warning: squelched 104 whitespace errors
warning: 109 lines add whitespace errors. 

It means: instead of displaying 100+ error messages, it warns you it should have displayed those errors (but it won't, in order to not clutter the output)

I have no definitive recommendations for whitespace policy, except from identifying why they are introduced in the first place.
If your editor doesn't convert the eol (end of lines) characters between Window and Unix, then it means it somehow add or remove automatically whitespaces, which is not always useful.

A first test (as in this blog post) is to de-activate the policy:

git config core.whitespace nowarn

or try

git config core.whitespace fix

and see if that facilitates your rebase operations.


Here is how to fix "trailing whitespace" errors when using git apply :

The first thing you need to know is : what is a whitespace error. This is explained on the core.whitespace setting documentation. Basically, git handles several kind of whitespace errors :

blank-at-eol
blank-at-eof
space-before-tab
indent-with-non-tab
tab-in-indent
cr-at-eol

trailing whitespace error can rise when patching a file using windows style line ending (CRLF). To avoid this warning, you can either ask git apply to not show warning :

git apply --whitespace=nowarn fix.patch

or you can edit git configuration on the fly (with -c) to say "ok git, CR at end of line are fine this time" :

git -c core.whitespace=cr-at-eol apply fix.patch

If you want to make it permanent, just edit the git configuration like that :

git config apply.whitespace nowarn

or :

git config core.whitespace cr-at-eol

After searching for that answer as well and looking into both the git-config and git-apply manuals, I found that

git config apply.whitespace nowarn

deactivates showing the whitespace errors in your current repository.

To make it available for all the repositories just add --global like this:

git config --global apply.whitespace nowarn