.gitconfig
is usually stored in the user.home
directory.
I use a different identity to work on projects for Company A and something else fo
Thanks @crea1
A small variant:
As it is written on https://git-scm.com/docs/git-config#_includes:
If the pattern ends with
/
,**
will be automatically added. For example, the patternfoo/
becomesfoo/**
. In other words, it matchesfoo
and everything inside, recursively.
So I use in my case,
~/.gitconfig :
[user] # as default, personal needs
email = myalias@personal-domain.fr
name = bcag2
[includeIf "gitdir:~/workspace/"] # job needs, like workspace/* so all included projects
path = .gitconfig-job
# all others section: core, alias, log…
So If the project directory is in my ~/wokspace/
, default user settings is replace with
~/.gitconfig-job :
[user]
name = John Smith
email = js@company.com