Skip to content

Commit 5a9b455

Browse files
committed
Merge branch 'jk/config-env-doc'
Documentation around GIT_CONFIG has been updated. * jk/config-env-doc: doc/git-config: simplify "override" advice for FILES section doc/git-config: clarify GIT_CONFIG environment variable doc/git-config: explain --file instead of referring to GIT_CONFIG
2 parents c018818 + 7342838 commit 5a9b455

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

Documentation/git-config.txt

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ codes are:
7171

7272
On success, the command returns the exit code 0.
7373

74+
[[OPTIONS]]
7475
OPTIONS
7576
-------
7677

@@ -143,7 +144,13 @@ See also <<FILES>>.
143144

144145
-f config-file::
145146
--file config-file::
146-
Use the given config file instead of the one specified by GIT_CONFIG.
147+
For writing options: write to the specified file rather than the
148+
repository `.git/config`.
149+
+
150+
For reading options: read only from the specified file rather than from all
151+
available files.
152+
+
153+
See also <<FILES>>.
147154

148155
--blob blob::
149156
Similar to `--file` but use the given blob instead of a file. E.g.
@@ -325,21 +332,14 @@ All writing options will per default write to the repository specific
325332
configuration file. Note that this also affects options like `--replace-all`
326333
and `--unset`. *'git config' will only ever change one file at a time*.
327334

328-
You can override these rules either by command-line options or by environment
329-
variables. The `--global`, `--system` and `--worktree` options will limit
330-
the file used to the global, system-wide or per-worktree file respectively.
331-
The `GIT_CONFIG` environment variable has a similar effect, but you
332-
can specify any filename you want.
335+
You can override these rules using the `--global`, `--system`,
336+
`--local`, `--worktree`, and `--file` command-line options; see
337+
<<OPTIONS>> above.
333338

334339

335340
ENVIRONMENT
336341
-----------
337342

338-
GIT_CONFIG::
339-
Take the configuration from the given file instead of .git/config.
340-
Using the "--global" option forces this to ~/.gitconfig. Using the
341-
"--system" option forces this to $(prefix)/etc/gitconfig.
342-
343343
GIT_CONFIG_GLOBAL::
344344
GIT_CONFIG_SYSTEM::
345345
Take the configuration from the given files instead from global or
@@ -367,6 +367,12 @@ This is useful for cases where you want to spawn multiple git commands
367367
with a common configuration but cannot depend on a configuration file,
368368
for example when writing scripts.
369369

370+
GIT_CONFIG::
371+
If no `--file` option is provided to `git config`, use the file
372+
given by `GIT_CONFIG` as if it were provided via `--file`. This
373+
variable has no effect on other Git commands, and is mostly for
374+
historical compatibility; there is generally no reason to use it
375+
instead of the `--file` option.
370376

371377
[[EXAMPLES]]
372378
EXAMPLES

0 commit comments

Comments
 (0)