It is possible for git to use different config references depending on specific conditions.
This was made aware to me by a question in an earlier post. (Thanks to @francoislp asked this question).
For example, if you have a working directory cloned under the ~/work/
directory and want to use the following configuration:
Add a conditional Include to ~/.gitconfig
like this:
[includeIf "gitdir:~/work/**"]
path = ~/work/.gitconfig
Then put the following in ~/work/.gitconfig
[user]
name = Foo
email = foo@example.com
Then, for commits in the working directory under ~/work
, the commit will be logged as Foo <foo@example.com>
.
As follows:
Top comments (0)