@@ -11,9 +11,7 @@ SYNOPSIS
11
11
[verse]
12
12
'git config list' [<file-option>] [<display-option>] [--includes]
13
13
'git config get' [<file-option>] [<display-option>] [--includes] [--all] [--regexp=<regexp>] [--value=<value>] [--fixed-value] [--default=<default>] <name>
14
- 'git config' [<file-option>] [--type=<type>] [--comment=<message>] [--fixed-value] [--show-origin] [--show-scope] [-z|--null] <name> [<value> [<value-pattern>]]
15
- 'git config' [<file-option>] [--type=<type>] [--comment=<message>] --add <name> <value>
16
- 'git config' [<file-option>] [--type=<type>] [--comment=<message>] [--fixed-value] --replace-all <name> <value> [<value-pattern>]
14
+ 'git config set' [<file-option>] [--type=<type>] [--comment=<message>] [--all] [--value=<value>] [--fixed-value] <name> <value>
17
15
'git config' [<file-option>] [--fixed-value] --unset <name> [<value-pattern>]
18
16
'git config' [<file-option>] [--fixed-value] --unset-all <name> [<value-pattern>]
19
17
'git config' [<file-option>] --rename-section <old-name> <new-name>
@@ -27,7 +25,7 @@ You can query/set/replace/unset options with this command. The name is
27
25
actually the section and the key separated by a dot, and the value will be
28
26
escaped.
29
27
30
- Multiple lines can be added to an option by using the `--add ` option.
28
+ Multiple lines can be added to an option by using the `--append ` option.
31
29
If you want to update or unset an option which can occur on multiple
32
30
lines, a `value-pattern` (which is an extended regular expression,
33
31
unless the `--fixed-value` option is given) needs to be given. Only the
82
80
emits all values associated with key. Returns error code 1 if key is
83
81
not present.
84
82
83
+ set::
84
+ Set value for one or more config options. By default, this command
85
+ refuses to write multi-valued config options. Passing `--all` will
86
+ replace all multi-valued config options with the new value, whereas
87
+ `--value=` will replace all config options whose values match the given
88
+ pattern.
89
+
85
90
[[OPTIONS]]
86
91
OPTIONS
87
92
-------
@@ -90,10 +95,9 @@ OPTIONS
90
95
Default behavior is to replace at most one line. This replaces
91
96
all lines matching the key (and optionally the `value-pattern`).
92
97
93
- --add ::
98
+ --append ::
94
99
Adds a new line to the option without altering any existing
95
- values. This is the same as providing '^$' as the `value-pattern`
96
- in `--replace-all`.
100
+ values. This is the same as providing '--value=^$' in `set`.
97
101
98
102
--comment <message>::
99
103
Append a comment at the end of new or modified lines.
@@ -296,6 +300,9 @@ recommended to migrate to the new syntax.
296
300
'git config <name>'::
297
301
Replaced by `git config get <name>`.
298
302
303
+ 'git config <name> <value> [<value-pattern>]'::
304
+ Replaced by `git config set [--value=<pattern>] <name> <value>`.
305
+
299
306
-l::
300
307
--list::
301
308
Replaced by `git config list`.
@@ -315,6 +322,9 @@ recommended to migrate to the new syntax.
315
322
--get-color <name> [<default>]::
316
323
Replaced by `git config get --type=color [--default=<default>] <name>`.
317
324
325
+ --add <name> <value>::
326
+ Replaced by `git config set --append <name> <value>`.
327
+
318
328
CONFIGURATION
319
329
-------------
320
330
`pager.config` is only respected when listing configuration, i.e., when
@@ -361,7 +371,7 @@ precedence over values read earlier. When multiple values are taken then all
361
371
values of a key from all files will be used.
362
372
363
373
By default, options are only written to the repository specific
364
- configuration file. Note that this also affects options like `--replace-all `
374
+ configuration file. Note that this also affects options like `set `
365
375
and `--unset`. *'git config' will only ever change one file at a time*.
366
376
367
377
You can limit which configuration sources are read from or written to by
@@ -497,15 +507,15 @@ Given a .git/config like this:
497
507
you can set the filemode to true with
498
508
499
509
------------
500
- % git config core.filemode true
510
+ % git config set core.filemode true
501
511
------------
502
512
503
513
The hypothetical proxy command entries actually have a postfix to discern
504
514
what URL they apply to. Here is how to change the entry for kernel.org
505
515
to "ssh".
506
516
507
517
------------
508
- % git config core.gitproxy '"ssh" for kernel.org' ' for kernel.org$ '
518
+ % git config set --value=' for kernel.org$' core.gitproxy '"ssh" for kernel.org'
509
519
------------
510
520
511
521
This makes sure that only the key/value pair for kernel.org is replaced.
@@ -541,26 +551,26 @@ If you like to live dangerously, you can replace *all* core.gitproxy by a
541
551
new one with
542
552
543
553
------------
544
- % git config --replace -all core.gitproxy ssh
554
+ % git config set - -all core.gitproxy ssh
545
555
------------
546
556
547
557
However, if you really only want to replace the line for the default proxy,
548
558
i.e. the one without a "for ..." postfix, do something like this:
549
559
550
560
------------
551
- % git config core.gitproxy ssh '! for '
561
+ % git config set --value= '! for ' core.gitproxy ssh
552
562
------------
553
563
554
564
To actually match only values with an exclamation mark, you have to
555
565
556
566
------------
557
- % git config section.key value '[!]'
567
+ % git config set -- value= '[!]' section.key value
558
568
------------
559
569
560
570
To add a new proxy, without altering any of the existing ones, use
561
571
562
572
------------
563
- % git config --add core.gitproxy '"proxy-command" for example.com'
573
+ % git config set --append core.gitproxy '"proxy-command" for example.com'
564
574
------------
565
575
566
576
An example to use customized color from the configuration in your
0 commit comments