Hi folks! Imagine you have work and personal profile for git on one OS and you want to git select proper email when you do git stuff.
File structure:
home-directory
├── .gitconfig
├── .gitconfig-personal
└── .gitconfig-work
.gitconfig:
...
[user]
name = Name Surname
[includeIf "gitdir:projects/"]
path = .gitconfig-personal
[includeIf "gitdir:work/"]
path = .gitconfig-work
...
.gitconfig-personal:
[user]
email = [email protected]
.gitconfig-work:
[user]
email = [email protected]
With this setup, when we do git stuff, we will have:
.
└── projects - all projects under this directory except work will have [email protected]
├── pet-project - we will have [email protected]
└── work - all projects under this derictory will have [email protected]
└── work-project - we will have [email protected]