You can conditionally include another Git config file based on your Git directory or branch in Git 2.13 and later.
For example in the
.gitconfig.work file, you can add or override configuration values you want when using a repository located in
~/work and its subdirectories:
[user] email = firstname.lastname@example.org
[user] email = email@example.com [includeIf "gitdir:~/work/"] path = .gitconfig.work