Skip to content

Commit 7da9800

Browse files
johnkeepinggitster
authored andcommitted
git-config(1): clarify precedence of multiple values
In order to clarify which value is used when there are multiple values defined for a key, re-order the list of file locations so that it runs from least specific to most specific. Then add a paragraph which simply says that the last value will be used. Signed-off-by: John Keeping <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent edca415 commit 7da9800

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Documentation/git-config.txt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,8 @@ FILES
197197
If not set explicitly with '--file', there are four files where
198198
'git config' will search for configuration options:
199199

200-
$GIT_DIR/config::
201-
Repository specific configuration file.
202-
203-
~/.gitconfig::
204-
User-specific configuration file. Also called "global"
205-
configuration file.
200+
$(prefix)/etc/gitconfig::
201+
System-wide configuration file.
206202

207203
$XDG_CONFIG_HOME/git/config::
208204
Second user-specific configuration file. If $XDG_CONFIG_HOME is not set
@@ -212,15 +208,23 @@ $XDG_CONFIG_HOME/git/config::
212208
you sometimes use older versions of Git, as support for this
213209
file was added fairly recently.
214210

215-
$(prefix)/etc/gitconfig::
216-
System-wide configuration file.
211+
~/.gitconfig::
212+
User-specific configuration file. Also called "global"
213+
configuration file.
214+
215+
$GIT_DIR/config::
216+
Repository specific configuration file.
217217

218218
If no further options are given, all reading options will read all of these
219219
files that are available. If the global or the system-wide configuration
220220
file are not available they will be ignored. If the repository configuration
221221
file is not available or readable, 'git config' will exit with a non-zero
222222
error code. However, in neither case will an error message be issued.
223223

224+
The files are read in the order given above, with last value found taking
225+
precedence over values read earlier. When multiple values are taken then all
226+
values of a key from all files will be used.
227+
224228
All writing options will per default write to the repository specific
225229
configuration file. Note that this also affects options like '--replace-all'
226230
and '--unset'. *'git config' will only ever change one file at a time*.

0 commit comments

Comments
 (0)