@@ -14,7 +14,8 @@ the fully qualified variable name of the variable itself is the last
14
14
dot-separated segment and the section name is everything before the last
15
15
dot. The variable names are case-insensitive, allow only alphanumeric
16
16
characters and `-`, and must start with an alphabetic character. Some
17
- variables may appear multiple times.
17
+ variables may appear multiple times; we say then that the variable is
18
+ multivalued.
18
19
19
20
Syntax
20
21
~~~~~~
@@ -25,7 +26,7 @@ blank lines are ignored.
25
26
26
27
The file consists of sections and variables. A section begins with
27
28
the name of the section in square brackets and continues until the next
28
- section begins. Section names are not case sensitive . Only alphanumeric
29
+ section begins. Section names are case-insensitive . Only alphanumeric
29
30
characters, `-` and `.` are allowed in section names. Each variable
30
31
must belong to some section, which means that there must be a section
31
32
header before the first setting of a variable.
@@ -40,8 +41,8 @@ in the section header, like in the example below:
40
41
--------
41
42
42
43
Subsection names are case sensitive and can contain any characters except
43
- newline (doublequote `"` and backslash have to be escaped as `\"` and `\\`,
44
- respectively). Section headers cannot span multiple
44
+ newline (doublequote `"` and backslash can be included by escaping them
45
+ as `\"` and `\\`, respectively). Section headers cannot span multiple
45
46
lines. Variables may belong directly to a section or to a given subsection.
46
47
You can have `[section]` if you have `[section "subsection"]`, but you
47
48
don't need to.
@@ -53,38 +54,27 @@ restrictions as section names.
53
54
54
55
All the other lines (and the remainder of the line after the section
55
56
header) are recognized as setting variables, in the form
56
- 'name = value'. If there is no equal sign on the line, the entire line
57
- is taken as 'name' and the variable is recognized as boolean "true".
57
+ 'name = value' (or just 'name', which is a short-hand to say that
58
+ the variable is the boolean "true") .
58
59
The variable names are case-insensitive, allow only alphanumeric characters
59
- and `-`, and must start with an alphabetic character. There can be more
60
- than one value for a given variable; we say then that the variable is
61
- multivalued.
60
+ and `-`, and must start with an alphabetic character.
62
61
63
- Leading and trailing whitespace in a variable value is discarded.
64
- Internal whitespace within a variable value is retained verbatim.
62
+ A line that defines a value can be continued to the next line by
63
+ ending it with a `\`; the backquote and the end-of-line are
64
+ stripped. Leading whitespaces after 'name =', the remainder of the
65
+ line after the first comment character '#' or ';', and trailing
66
+ whitespaces of the line are discarded unless they are enclosed in
67
+ double quotes. Internal whitespaces within the value are retained
68
+ verbatim.
65
69
66
- The values following the equals sign in variable assign are all either
67
- a string, an integer, or a boolean. Boolean values may be given as yes/no,
68
- 1/0, true/false or on/off. Case is not significant in boolean values, when
69
- converting value to the canonical form using '--bool' type specifier;
70
- 'git config' will ensure that the output is "true" or "false".
71
-
72
- String values may be entirely or partially enclosed in double quotes.
73
- You need to enclose variable values in double quotes if you want to
74
- preserve leading or trailing whitespace, or if the variable value contains
75
- comment characters (i.e. it contains '#' or ';').
76
- Double quote `"` and backslash `\` characters in variable values must
77
- be escaped: use `\"` for `"` and `\\` for `\`.
70
+ Inside double quotes, double quote `"` and backslash `\` characters
71
+ must be escaped: use `\"` for `"` and `\\` for `\`.
78
72
79
73
The following escape sequences (beside `\"` and `\\`) are recognized:
80
74
`\n` for newline character (NL), `\t` for horizontal tabulation (HT, TAB)
81
75
and `\b` for backspace (BS). Other char escape sequences (including octal
82
76
escape sequences) are invalid.
83
77
84
- Variable values ending in a `\` are continued on the next line in the
85
- customary UNIX fashion.
86
-
87
- Some variables may require a special value format.
88
78
89
79
Includes
90
80
~~~~~~~~
@@ -126,6 +116,61 @@ Example
126
116
path = foo ; expand "foo" relative to the current file
127
117
path = ~/foo ; expand "foo" in your $HOME directory
128
118
119
+
120
+ Values
121
+ ~~~~~~
122
+
123
+ Values of many variables are treated as a simple string, but there
124
+ are variables that take values of specific types and there are rules
125
+ as to how to spell them.
126
+
127
+ boolean::
128
+
129
+ When a variable is said to take a boolean value, many
130
+ synonyms are accepted for 'true' and 'false'; these are all
131
+ case-insensitive.
132
+
133
+ true;; Boolean true can be spelled as `yes`, `on`, `true`,
134
+ or `1`. Also, a variable defined without `= <value>`
135
+ is taken as true.
136
+
137
+ false;; Boolean false can be spelled as `no`, `off`,
138
+ `false`, or `0`.
139
+ +
140
+ When converting value to the canonical form using '--bool' type
141
+ specifier; 'git config' will ensure that the output is "true" or
142
+ "false" (spelled in lowercase).
143
+
144
+ integer::
145
+ The value for many variables that specify various sizes can
146
+ be suffixed with `k`, `M`,... to mean "scale the number by
147
+ 1024", "by 1024x1024", etc.
148
+
149
+ color::
150
+ The value for a variables that takes a color is a list of
151
+ colors (at most two) and attributes (at most one), separated
152
+ by spaces. The colors accepted are `normal`, `black`,
153
+ `red`, `green`, `yellow`, `blue`, `magenta`, `cyan` and
154
+ `white`; the attributes are `bold`, `dim`, `ul`, `blink` and
155
+ `reverse`. The first color given is the foreground; the
156
+ second is the background. The position of the attribute, if
157
+ any, doesn't matter. Attributes may be turned off
158
+ specifically by prefixing them with `no` (e.g., `noreverse`,
159
+ `noul`, etc).
160
+ +
161
+ Colors (foreground and background) may also be given as numbers between
162
+ 0 and 255; these use ANSI 256-color mode (but note that not all
163
+ terminals may support this). If your terminal supports it, you may also
164
+ specify 24-bit RGB values as hex, like `#ff0ab3`.
165
+ +
166
+ The attributes are meant to be reset at the beginning of each item
167
+ in the colored output, so setting color.decorate.branch to `black`
168
+ will paint that branch name in a plain `black`, even if the previous
169
+ thing on the same output line (e.g. opening parenthesis before the
170
+ list of branch names in `log --decorate` output) is set to be
171
+ painted with `bold` or some other attribute.
172
+
173
+
129
174
Variables
130
175
~~~~~~~~~
131
176
@@ -846,20 +891,6 @@ color.branch.<slot>::
846
891
`remote` (a remote-tracking branch in refs/remotes/),
847
892
`upstream` (upstream tracking branch), `plain` (other
848
893
refs).
849
- +
850
- The value for these configuration variables is a list of colors (at most
851
- two) and attributes (at most one), separated by spaces. The colors
852
- accepted are `normal`, `black`, `red`, `green`, `yellow`, `blue`,
853
- `magenta`, `cyan` and `white`; the attributes are `bold`, `dim`, `ul`,
854
- `blink` and `reverse`. The first color given is the foreground; the
855
- second is the background. The position of the attribute, if any,
856
- doesn't matter. Attributes may be turned off specifically by prefixing
857
- them with `no` (e.g., `noreverse`, `noul`, etc).
858
- +
859
- Colors (foreground and background) may also be given as numbers between
860
- 0 and 255; these use ANSI 256-color mode (but note that not all
861
- terminals may support this). If your terminal supports it, you may also
862
- specify 24-bit RGB values as hex, like `#ff0ab3`.
863
894
864
895
color.diff::
865
896
Whether to use ANSI escape sequences to add color to patches.
@@ -879,8 +910,7 @@ color.diff.<slot>::
879
910
of `plain` (context text), `meta` (metainformation), `frag`
880
911
(hunk header), 'func' (function in hunk header), `old` (removed lines),
881
912
`new` (added lines), `commit` (commit headers), or `whitespace`
882
- (highlighting whitespace errors). The values of these variables may be
883
- specified as in color.branch.<slot>.
913
+ (highlighting whitespace errors).
884
914
885
915
color.decorate.<slot>::
886
916
Use customized color for 'git log --decorate' output. `<slot>` is one
@@ -917,8 +947,6 @@ color.grep.<slot>::
917
947
separators between fields on a line (`:`, `-`, and `=`)
918
948
and between hunks (`--`)
919
949
--
920
- +
921
- The values of these variables may be specified as in color.branch.<slot>.
922
950
923
951
color.interactive::
924
952
When set to `always`, always use colors for interactive prompts
@@ -931,8 +959,7 @@ color.interactive.<slot>::
931
959
Use customized color for 'git add --interactive' and 'git clean
932
960
--interactive' output. `<slot>` may be `prompt`, `header`, `help`
933
961
or `error`, for four distinct types of normal output from
934
- interactive commands. The values of these variables may be
935
- specified as in color.branch.<slot>.
962
+ interactive commands.
936
963
937
964
color.pager::
938
965
A boolean to enable/disable colored output when the pager is in
@@ -958,8 +985,7 @@ color.status.<slot>::
958
985
`untracked` (files which are not tracked by Git),
959
986
`branch` (the current branch), or
960
987
`nobranch` (the color the 'no branch' warning is shown in, defaulting
961
- to red). The values of these variables may be specified as in
962
- color.branch.<slot>.
988
+ to red).
963
989
964
990
color.ui::
965
991
This variable determines the default value for variables such
0 commit comments