In what git version became the git config --local
option available, and where can I read more about it?
I thought that not providing --global
will automatically assume that it's a local config variable. Why was this new option necessary?
In what git version became the git config --local
option available, and where can I read more about it?
I thought that not providing --global
will automatically assume that it's a local config variable. Why was this new option necessary?
Since the git sources are maintained in git, we can find the revision that introduced the --local
option:
commit 57210a678a8bedd222bf4478eeb0a664d9dd5369
Author: Sverre Rabbelier <srabbelier@gmail.com>
Date: 2010-08-03 20:59:23 -0500
config: add --local option
This is a shorthand similar to --system but instead uses
the config file of the current repository.
It appears that this change first appeared in release 1.7.4 which came out in late 2010 or so.
As far as I can tell from a quick look at the source code (builtin/config.h
) and man page, the default is local unless certain environment variables are set, particularly $GIT_CONFIG
. The --local
option explicitly overrides any environment variable settings.
See VonC's answer for more information on the semantics of --local
(the documentation was updated after I originally posted this answer).
Note that the description for that --local
option has only recently (June 2013, three years later) been updated:
Commit 560d4b86abc547dfb10b116ab99c800d68ae8849:
config: Add description of
--local
optionIt was missed in the option list while mentioned from the general description.
Add it for completeness.
The description is now:
--local::
- For writing options: write to the repository
.git/config
file.
This is the default behavior.- For reading options: read only from the repository
.git/config
rather than from all available files.