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 = personal@email.com
.gitconfig-work:
[user]
email = work@company.com
With this setup, when we do git stuff, we will have:
.
└── projects - all projects under this directory except work will have personal@email.com
├── pet-project - we will have personal@email.com
└── work - all projects under this derictory will have work@company.com
└── work-project - we will have work@company.com