Skip to content

Commit e70aee5

Browse files
committed
Merge branch 'jk/maint-config-multi-order'
* jk/maint-config-multi-order: git-config(1): clarify precedence of multiple values
2 parents 8a64822 + 7da9800 commit e70aee5

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
@@ -206,12 +206,8 @@ FILES
206206
If not set explicitly with '--file', there are four files where
207207
'git config' will search for configuration options:
208208

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

216212
$XDG_CONFIG_HOME/git/config::
217213
Second user-specific configuration file. If $XDG_CONFIG_HOME is not set
@@ -221,15 +217,23 @@ $XDG_CONFIG_HOME/git/config::
221217
you sometimes use older versions of Git, as support for this
222218
file was added fairly recently.
223219

224-
$(prefix)/etc/gitconfig::
225-
System-wide configuration file.
220+
~/.gitconfig::
221+
User-specific configuration file. Also called "global"
222+
configuration file.
223+
224+
$GIT_DIR/config::
225+
Repository specific configuration file.
226226

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

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

0 commit comments

Comments
 (0)