Is there a way to pass git config options to commands at runtime?
Example use case:
The git commit
command does not have a -U
option (ie. git diff
) to change context lines of -v
verbose output, and the user does not want to set diff.context
in config files.
man git
:
-c <name>=<value>
Pass a configuration parameter to the command. The value given will override values from configuration files. The is expected in the same format as listed by git config (subkeys separated by dots).
Note that omitting the
=
ingit -c foo.bar...
is allowed and setsfoo.bar
to the boolean true value (just like[foo]bar
would in a config file). Including the equals but with an empty value (likegit -c foo.bar=...
) sets foo.bar to the empty string whichgit config --type=bool
will convert to false.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.