Setup and Config
Getting and Creating Projects
Basic Snapshotting
Branching and Merging
Sharing and Updating Projects
Inspection and Comparison
Patching
Debugging
External Systems
Server Admin
Guides
- gitattributes
- Command-line interface conventions
- Everyday Git
- Frequently Asked Questions (FAQ)
- Glossary
- Hooks
- gitignore
- gitmodules
- Revisions
- Submodules
- Tutorial
- Workflows
- All guides...
Administration
Plumbing Commands
-
2.52.0
2025-11-17
-
2.51.2
2025-10-27
-
2.51.1
2025-10-15
-
2.51.0
2025-08-18
- 2.50.1 no changes
-
2.50.0
2025-06-16
- 2.49.1 no changes
-
2.49.0
2025-03-14
- 2.48.2 no changes
-
2.48.1
2025-01-13
-
2.48.0
2025-01-10
- 2.47.3 no changes
-
2.47.2
2024-11-26
-
2.47.1
2024-11-25
-
2.47.0
2024-10-06
- 2.46.4 no changes
-
2.46.3
2024-11-26
-
2.46.2
2024-09-23
-
2.46.1
2024-09-13
-
2.46.0
2024-07-29
- 2.45.4 no changes
-
2.45.3
2024-11-26
- 2.45.1 → 2.45.2 no changes
-
2.45.0
2024-04-29
- 2.44.4 no changes
-
2.44.3
2024-11-26
- 2.44.1 → 2.44.2 no changes
-
2.44.0
2024-02-23
- 2.43.7 no changes
-
2.43.6
2024-11-26
- 2.43.2 → 2.43.5 no changes
-
2.43.1
2024-02-09
-
2.43.0
2023-11-20
-
2.42.4
2024-11-26
- 2.42.2 → 2.42.3 no changes
-
2.42.1
2023-11-02
-
2.42.0
2023-08-21
-
2.41.3
2024-11-26
- 2.41.1 → 2.41.2 no changes
-
2.41.0
2023-06-01
-
2.40.4
2024-11-26
- 2.40.1 → 2.40.3 no changes
-
2.40.0
2023-03-12
- 2.39.1 → 2.39.5 no changes
-
2.39.0
2022-12-12
- 2.38.3 → 2.38.5 no changes
-
2.38.2
2022-12-11
-
2.38.1
2022-10-07
-
2.38.0
2022-10-02
- 2.37.5 → 2.37.7 no changes
-
2.37.4
2022-10-06
- 2.37.3 no changes
-
2.37.2
2022-08-11
- 2.37.1 no changes
-
2.37.0
2022-06-27
- 2.36.4 → 2.36.6 no changes
-
2.36.3
2022-10-06
-
2.36.2
2022-06-23
- 2.36.1 no changes
-
2.36.0
2022-04-18
- 2.35.6 → 2.35.8 no changes
-
2.35.5
2022-10-06
-
2.35.4
2022-06-23
-
2.35.3
2022-04-13
-
2.35.2
2022-03-23
- 2.35.1 no changes
-
2.35.0
2022-01-24
- 2.34.6 → 2.34.8 no changes
-
2.34.5
2022-10-06
-
2.34.4
2022-06-23
-
2.34.3
2022-04-13
-
2.34.2
2022-03-23
- 2.34.1 no changes
-
2.34.0
2021-11-15
- 2.33.6 → 2.33.8 no changes
-
2.33.5
2022-10-06
-
2.33.4
2022-06-23
-
2.33.3
2022-04-13
-
2.33.2
2022-03-23
-
2.33.1
2021-10-12
-
2.33.0
2021-08-16
- 2.32.5 → 2.32.7 no changes
-
2.32.4
2022-10-06
-
2.32.3
2022-06-23
-
2.32.2
2022-04-13
-
2.32.1
2022-03-23
-
2.32.0
2021-06-06
- 2.31.6 → 2.31.8 no changes
-
2.31.5
2022-10-06
-
2.31.4
2022-06-23
-
2.31.3
2022-04-13
-
2.31.2
2022-03-23
-
2.31.1
2021-03-26
-
2.31.0
2021-03-15
- 2.30.7 → 2.30.9 no changes
-
2.30.6
2022-10-06
-
2.30.5
2022-06-23
-
2.30.4
2022-04-13
-
2.30.3
2022-03-23
- 2.30.2 no changes
-
2.30.1
2021-02-08
-
2.30.0
2020-12-27
- 2.29.1 → 2.29.3 no changes
-
2.29.0
2020-10-19
- 2.28.1 no changes
-
2.28.0
2020-07-27
- 2.27.1 no changes
-
2.27.0
2020-06-01
- 2.26.1 → 2.26.3 no changes
-
2.26.0
2020-03-22
- 2.25.3 → 2.25.5 no changes
-
2.25.2
2020-03-17
-
2.25.1
2020-02-17
-
2.25.0
2020-01-13
- 2.24.1 → 2.24.4 no changes
-
2.24.0
2019-11-04
- 2.23.1 → 2.23.4 no changes
-
2.23.0
2019-08-16
- 2.22.2 → 2.22.5 no changes
-
2.22.1
2019-08-11
-
2.22.0
2019-06-07
- 2.21.1 → 2.21.4 no changes
-
2.21.0
2019-02-24
- 2.20.1 → 2.20.5 no changes
-
2.20.0
2018-12-09
- 2.19.3 → 2.19.6 no changes
-
2.19.2
2018-11-21
- 2.19.1 no changes
-
2.19.0
2018-09-10
- 2.18.1 → 2.18.5 no changes
-
2.18.0
2018-06-21
- 2.17.1 → 2.17.6 no changes
-
2.17.0
2018-04-02
-
2.16.6
2019-12-06
-
2.15.4
2019-12-06
-
2.14.6
2019-12-06
-
2.13.7
2018-05-22
-
2.12.5
2017-09-22
-
2.11.4
2017-09-22
-
2.10.5
2017-09-22
-
2.9.5
2017-07-30
-
2.8.6
2017-07-30
-
2.7.6
2017-07-30
-
2.6.7
2017-05-05
-
2.5.6
2017-05-05
-
2.4.12
2017-05-05
-
2.3.10
2015-09-28
-
2.2.3
2015-09-04
-
2.1.4
2014-12-17
-
2.0.5
2014-12-17
SYNOPSIS
git config list [<file-option>] [<display-option>] [--includes] git config get [<file-option>] [<display-option>] [--includes] [--all] [--regexp] [--value=<pattern>] [--fixed-value] [--default=<default>] [--url=<url>] <name> git config set [<file-option>] [--type=<type>] [--all] [--value=<pattern>] [--fixed-value] <name> <value> git config unset [<file-option>] [--all] [--value=<pattern>] [--fixed-value] <name> git config rename-section [<file-option>] <old-name> <new-name> git config remove-section [<file-option>] <name> git config edit [<file-option>] git config [<file-option>] --get-colorbool <name> [<stdout-is-tty>]
DESCRIPTION
You can query/set/replace/unset options with this command. The name is actually the section and the key separated by a dot, and the value will be escaped.
Multiple lines can be added to an option by using the --append option.
If you want to update or unset an option which can occur on multiple
lines, --value=<pattern> (which is an extended regular expression,
unless the --fixed-value option is given) needs to be given. Only the
existing values that match the pattern are updated or unset. If
you want to handle the lines that do not match the pattern, just
prepend a single exclamation mark in front (see also EXAMPLES),
but note that this only works when the --fixed-value option is not
in use.
The --type=<type> option instructs git config to ensure that incoming and
outgoing values are canonicalize-able under the given <type>. If no
--type=<type> is given, no canonicalization will be performed. Callers may
unset an existing --type specifier with --no-type.
When reading, the values are read from the system, global and
repository local configuration files by default, and options
--system, --global, --local, --worktree and
--file <filename> can be used to tell the command to read from only
that location (see FILES).
When writing, the new value is written to the repository local
configuration file by default, and options --system, --global,
--worktree, --file <filename> can be used to tell the command to
write to that location (you can say --local but that is the
default).
This command will fail with non-zero status upon error. Some exit codes are:
-
The section or key is invalid (ret=1),
-
no section or name was provided (ret=2),
-
the config file is invalid (ret=3),
-
the config file cannot be written (ret=4),
-
you try to unset an option which does not exist (ret=5),
-
you try to unset/set an option for which multiple lines match (ret=5), or
-
you try to use an invalid regexp (ret=6).
On success, the command returns the exit code 0.
A list of all available configuration variables can be obtained using the
git help --config command.
COMMANDS
- list
-
List all variables set in config file, along with their values.
- get
-
Emits the value of the specified key. If key is present multiple times in the configuration, emits the last value. If
--allis specified, emits all values associated with key. Returns error code 1 if key is not present. - set
-
Set value for one or more config options. By default, this command refuses to write multi-valued config options. Passing
--allwill replace all multi-valued config options with the new value, whereas--value=will replace all config options whose values match the given pattern. - unset
-
Unset value for one or more config options. By default, this command refuses to unset multi-valued keys. Passing
--allwill unset all multi-valued config options, whereas--valuewill unset all config options whose values match the given pattern. - rename-section
-
Rename the given section to a new name.
- remove-section
-
Remove the given section from the configuration file.
- edit
-
Opens an editor to modify the specified config file; either
--system,--global,--local(default),--worktree, or--file<config-file>.
OPTIONS
- --replace-all
-
Default behavior is to replace at most one line. This replaces all lines matching the key (and optionally
--value=<pattern>). - --append
-
Adds a new line to the option without altering any existing values. This is the same as providing --value=^$ in
set. - --comment <message>
-
Append a comment at the end of new or modified lines.
If <message> begins with one or more whitespaces followed by "", it is used as-is. If it begins with "", a space is prepended before it is used. Otherwise, a string " # " (a space followed by a hash followed by a space) is prepended to it. And the resulting string is placed immediately after the value defined for the variable. The <message> must not contain linefeed characters (no multi-line comments are permitted).
- --all
-
With
get, return all values for a multi-valued key. - --regexp
-
With
get, interpret the name as a regular expression. Regular expression matching is currently case-sensitive and done against a canonicalized version of the key in which section and variable names are lowercased, but subsection names are not. - --url=<URL>
-
When given a two-part <name> as <section>.<key>, the value for <section>.<URL>.<key> whose <URL> part matches the best to the given URL is returned (if no such key exists, the value for <section>.<key> is used as a fallback). When given just the <section> as name, do so for all the keys in the section and list them. Returns error code 1 if no value is found.
- --global
-
For writing options: write to global
~/.gitconfigfile rather than the repository.git/config, write to$XDG_CONFIG_HOME/git/configfile if this file exists and the~/.gitconfigfile doesn’t.For reading options: read only from global
~/.gitconfigand from$XDG_CONFIG_HOME/git/configrather than from all available files.See also FILES.
- --system
-
For writing options: write to system-wide
$(prefix)/etc/gitconfigrather than the repository.git/config.For reading options: read only from system-wide
$(prefix)/etc/gitconfigrather than from all available files.See also FILES.
- --local
-
For writing options: write to the repository
.git/configfile. This is the default behavior.For reading options: read only from the repository
.git/configrather than from all available files.See also FILES.
- --worktree
-
Similar to
--localexcept that$GIT_DIR/config.worktreeis read from or written to ifextensions.worktreeConfigis enabled. If not it’s the same as--local. Note that$GIT_DIRis equal to$GIT_COMMON_DIRfor the main working tree, but is of the form$GIT_DIR/worktrees/<id>/for other working trees. See git-worktree[1] to learn how to enableextensions.worktreeConfig. - -f <config-file>
- --file <config-file>
-
For writing options: write to the specified file rather than the repository
.git/config.For reading options: read only from the specified file rather than from all available files.
See also FILES.
- --blob <blob>
-
Similar to
--filebut use the given blob instead of a file. E.g. you can use master:.gitmodules to read values from the file .gitmodules in the master branch. See "SPECIFYING REVISIONS" section in gitrevisions[7] for a more complete list of ways to spell blob names. --value=<pattern>--no-value-
With
get,set, andunset, match only against <pattern>. The pattern is an extended regular expression unless--fixed-valueis given.Use
--no-valueto unset <pattern>. - --fixed-value
-
When used with
--value=<pattern>, treat <pattern> as an exact string instead of a regular expression. This will restrict the name/value pairs that are matched to only those where the value is exactly equal to <pattern>. - --type <type>
-
git config will ensure that any input or output is valid under the given type constraint(s), and will canonicalize outgoing values in <type>'s canonical form.
Valid <type>'s include:
-
bool: canonicalize values
true,yes,on, and positive numbers as "true", and valuesfalse,no,offand0as "false". -
int: canonicalize values as simple decimal numbers. An optional suffix of k, m, or g will cause the value to be multiplied by 1024, 1048576, or 1073741824 upon input.
-
bool-or-int: canonicalize according to either bool or int, as described above.
-
path: canonicalize by expanding a leading
~to the value of$HOMEand~userto the home directory for the specified user. This specifier has no effect when setting the value (but you can usegitconfigsection.variable~/from the command line to let your shell do the expansion.) -
expiry-date: canonicalize by converting from a fixed or relative date-string to a timestamp. This specifier has no effect when setting the value.
-
color: When getting a value, canonicalize by converting to an ANSI color escape sequence. When setting a value, a sanity-check is performed to ensure that the given value is canonicalize-able as an ANSI color, but it is written as-is.
-
- --bool
- --int
- --bool-or-int
- --path
- --expiry-date
-
Historical options for selecting a type specifier. Prefer instead
--type(see above). - --no-type
-
Un-sets the previously set type specifier (if one was previously set). This option requests that git config not canonicalize the retrieved variable.
--no-typehas no effect without--type=<type> or--<type>. - -z
- --null
-
For all options that output values and/or keys, always end values with the null character (instead of a newline). Use newline instead as a delimiter between key and value. This allows for secure parsing of the output without getting confused e.g. by values that contain line breaks.
- --name-only
-
Output only the names of config variables for
listorget.