Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When did git introduce the "--local" switch for git config command?

Tags:

git

git-config

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?

like image 508
András Szepesházi Avatar asked Mar 09 '12 10:03

András Szepesházi


1 Answers

Since the git sources are maintained in git, we can find the revision that introduced the --local option:

commit 57210a678a8bedd222bf4478eeb0a664d9dd5369
Author: Sverre Rabbelier <[email protected]>
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).

like image 164
Keith Thompson Avatar answered Oct 23 '22 09:10

Keith Thompson