@@ -11,9 +11,7 @@ SYNOPSIS
1111[verse]
1212'git config list' [<file-option>] [<display-option>] [--includes]
1313'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>
1715'git config' [<file-option>] [--fixed-value] --unset <name> [<value-pattern>]
1816'git config' [<file-option>] [--fixed-value] --unset-all <name> [<value-pattern>]
1917'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
2725actually the section and the key separated by a dot, and the value will be
2826escaped.
2927
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.
3129If you want to update or unset an option which can occur on multiple
3230lines, a `value-pattern` (which is an extended regular expression,
3331unless the `--fixed-value` option is given) needs to be given. Only the
8280 emits all values associated with key. Returns error code 1 if key is
8381 not present.
8482
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+
8590[[OPTIONS]]
8691OPTIONS
8792-------
@@ -90,10 +95,9 @@ OPTIONS
9095 Default behavior is to replace at most one line. This replaces
9196 all lines matching the key (and optionally the `value-pattern`).
9297
93- --add ::
98+ --append ::
9499 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`.
97101
98102--comment <message>::
99103 Append a comment at the end of new or modified lines.
@@ -296,6 +300,9 @@ recommended to migrate to the new syntax.
296300'git config <name>'::
297301 Replaced by `git config get <name>`.
298302
303+ 'git config <name> <value> [<value-pattern>]'::
304+ Replaced by `git config set [--value=<pattern>] <name> <value>`.
305+
299306-l::
300307--list::
301308 Replaced by `git config list`.
@@ -315,6 +322,9 @@ recommended to migrate to the new syntax.
315322--get-color <name> [<default>]::
316323 Replaced by `git config get --type=color [--default=<default>] <name>`.
317324
325+ --add <name> <value>::
326+ Replaced by `git config set --append <name> <value>`.
327+
318328CONFIGURATION
319329-------------
320330`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
361371values of a key from all files will be used.
362372
363373By 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 `
365375and `--unset`. *'git config' will only ever change one file at a time*.
366376
367377You can limit which configuration sources are read from or written to by
@@ -497,15 +507,15 @@ Given a .git/config like this:
497507you can set the filemode to true with
498508
499509------------
500- % git config core.filemode true
510+ % git config set core.filemode true
501511------------
502512
503513The hypothetical proxy command entries actually have a postfix to discern
504514what URL they apply to. Here is how to change the entry for kernel.org
505515to "ssh".
506516
507517------------
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'
509519------------
510520
511521This 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
541551new one with
542552
543553------------
544- % git config --replace -all core.gitproxy ssh
554+ % git config set - -all core.gitproxy ssh
545555------------
546556
547557However, if you really only want to replace the line for the default proxy,
548558i.e. the one without a "for ..." postfix, do something like this:
549559
550560------------
551- % git config core.gitproxy ssh '! for '
561+ % git config set --value= '! for ' core.gitproxy ssh
552562------------
553563
554564To actually match only values with an exclamation mark, you have to
555565
556566------------
557- % git config section.key value '[!]'
567+ % git config set -- value= '[!]' section.key value
558568------------
559569
560570To add a new proxy, without altering any of the existing ones, use
561571
562572------------
563- % git config --add core.gitproxy '"proxy-command" for example.com'
573+ % git config set --append core.gitproxy '"proxy-command" for example.com'
564574------------
565575
566576An example to use customized color from the configuration in your
0 commit comments