Skip to content

Latest commit

 

History

History
111 lines (99 loc) · 3.57 KB

File metadata and controls

111 lines (99 loc) · 3.57 KB

git-config-batch(1)

NAME

git-config-batch - Get and set options using machine-parseable interface

SYNOPSIS

git config-batch <options>

DESCRIPTION

Tools frequently need to change their behavior based on values stored in Git’s configuration files. These files may have complicated conditions for including extra files, so it is difficult to produce an independent parser. To avoid executing multiple processes to discover or modify multiple configuration values, the git config-batch command allows a single process to handle multiple requests using a machine-parseable interface across stdin and stdout.

PROTOCOL

By default, the protocol uses line feeds (LF) to signal the end of a command over stdin or a response over stdout.

The protocol will be extended in the future, and consumers should be resilient to older Git versions not understanding the latest command set. Thus, if the Git version includes the git config-batch builtin but doesn’t understand an input command, it will return a single line response:

unknown_command LF

These are the commands that are currently understood:

help version 1

The help command lists the currently-available commands in this version of Git. The output is multi-line, but the first line provides the count of possible commands via help count <N>. The next <N> lines are of the form help <command> <version> to state that this Git version supports that <command> at version <version>. Note that the same command may have multiple available versions.

Here is the currentl output of the help text at the latest version:

help 1 count 2
help 1 help 1
help 1 get 1
get version 1

The get command searches the config key-value pairs within a given <scope> for values that match the fixed <key> and filters the resulting value based on an optional <value-filter>. This can either be a regex or a fixed value. The command format is one of the following formats:

get 1 <scope> <key>
get 1 <scope> <key> arg:regex <value-pattern>
get 1 <scope> <key> arg:fixed-value <value>

The <scope> value can be one of inherited, system, global, local, worktree, submodule, or command. If inherited, then all config key-value pairs will be considered regardless of scope. Otherwise, only the given scope will be considered.

If no optional arguments are given, then the value will not be filtered by any pattern matching. If arg:regex is specified, then the rest of the line is considered a single string, <value-pattern>, and is interpreted as a regular expression for matching against stored values, similar to specifying a value to get config --get <key> "<value-pattern>". If arg:fixed-value is specified, then the rest of the line is considered a single string, <value>, and is checked for an exact match against the key-value pairs, simmilar to git config --get <key> --fixed-value "<value>".

At mmost one key-value pair is returned, that being the last key-value pair in the standard config order by scope and sequence within each scope.

If a key-value pair is found, then the following output is given:

get 1 found <key> <scope> <value>

If no matching key-value pair is found, then the following output is given:

get 1 missing <key> [<value-pattern>|<value>]

where <value-pattern> or <value> is only supplied if provided in the command.

SEE ALSO

linkgit:git-config[1]

GIT

Part of the linkgit:git[1] suite