Skip to content

Commit dc8c319

Browse files
authored
Merge pull request #699 from shengbinmeng/patch-1.1
Correct wrong statement on whitespace config
2 parents cb7fdd8 + 232391f commit dc8c319

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

book/08-customizing-git/sections/config.asc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,21 @@ The three that are turned on by default are `blank-at-eol`, which looks for spac
421421
The three that are disabled by default but can be turned on are `indent-with-non-tab`, which looks for lines that begin with spaces instead of tabs (and is controlled by the `tabwidth` option); `tab-in-indent`, which watches for tabs in the indentation portion of a line; and `cr-at-eol`, which tells Git that carriage returns at the end of lines are OK.
422422

423423
You can tell Git which of these you want enabled by setting `core.whitespace` to the values you want on or off, separated by commas.
424-
You can disable settings by either leaving them out of the setting string or prepending a `-` in front of the value.
425-
For example, if you want all but `cr-at-eol` to be set, you can do this (with `trailing-space` being a short-hand to cover both `blank-at-eol` and `blank-at-eof`):
424+
You can disable an option by prepending a `-` in front of its name, or use the default value by leaving it out of the setting string entirely.
425+
For example, if you want all but `space-before-tab` to be set, you can do this (with `trailing-space` being a short-hand to cover both `blank-at-eol` and `blank-at-eof`):
426426

427427
[source,console]
428428
----
429429
$ git config --global core.whitespace \
430-
trailing-space,space-before-tab,indent-with-non-tab,tab-in-indent
430+
trailing-space,-space-before-tab,indent-with-non-tab,tab-in-indent,cr-at-eol
431+
----
432+
433+
Or you can specify the customizing part only:
434+
435+
[source,console]
436+
----
437+
$ git config --global core.whitespace \
438+
-space-before-tab,indent-with-non-tab,tab-in-indent,cr-at-eol
431439
----
432440

433441
Git will detect these issues when you run a `git diff` command and try to color them so you can possibly fix them before you commit.

0 commit comments

Comments
 (0)