Git has a feature called Conditional Include using which I can make it use a different config file depending on the condition such as the repo directory name or branch name.
For example, depending on the repo directory name I could make Git automatically use a different email config for checking in commits. Here is how to do that:
~/.gitconfigfile, I introduce a conditional include using
includeIffor repos that lie inside my
[user] name = Joe Guy email = email@example.com [includeIf "gitdir:~/funrepos/"] path = ~/.gitconfig.funrepos
~/.gitconfig.funreposwith a different email to use for fun hack repos:
[user] email = firstname.lastname@example.org
Tried with: Git 2.17.1 and Ubuntu 18.04