User Tools

Site Tools


This is an old revision of the document!

Table of Contents


A moderately (dis)organized list of features related to dealing with whitespace issues in Git, in no particular order.

git diff

Flag whitespace errors:

$ git diff --check

git rebase

--ignore-whitespace, --whitespace=<option>
    These flag are passed to the git apply program (see git-apply(1)) that applies
    the patch. Incompatible with the --interactive option.

From man git-apply:

--ignore-space-change, --ignore-whitespace
    When applying a patch, ignore changes in whitespace in context lines if
    necessary. Context lines will preserve their whitespace, and they will not
    undergo whitespace fixing regardless of the value of the --whitespace option.
    New lines will still be fixed, though.

    When applying a patch, detect a new or modified line that has whitespace
    errors. What are considered whitespace errors is controlled by core.whitespace
    configuration. By default, trailing whitespaces (including lines that solely
    consist of whitespaces) and a space character that is immediately followed by
    a tab character inside the initial indent of the line are considered
    whitespace errors.

    By default, the command outputs warning messages but applies the patch. When
    git-apply is used for statistics and not applying a patch, it defaults to
    You can use different <action> values to control this behavior:

    ·   nowarn turns off the trailing whitespace warning.

    ·   warn outputs warnings for a few such errors, but applies the patch as-is

    ·   fix outputs warnings for a few such errors, and applies the patch after
        fixing them (strip is a synonym --- the tool used to consider only
        trailing whitespace characters as errors, and the fix involved stripping
        them, but modern Gits do more).

    ·   error outputs warnings for a few such errors, and refuses to apply the

    ·   error-all is similar to error but shows all errors.
git_whitespace.1528715201.txt.gz · Last modified: 2018/06/11 11:06 by rpjday