It's possible to conditionally extend the git configuration based on where your repository is located in your file system. That means we can have a global git configuration with all the default configuration and then in a few overrides for all repositories within, for example, the ~/code/work/ folder by adding a little something like this to the ~/.gitconfig file.
via https://dev.to/tastefulelk/conditional-git-profile-configuration-212b
// ~/.gitconfig
[user]
name = Sebastian Bille
email = [email protected]
[includeIf "gitdir:~/code/work/"]
path = ~/code/work/.gitconfig
// ~/code/work/.gitconfig
[user]
email = [email protected]
Now all repositories inside of the ~/code/work/ folder will use your overridden email but all others will keep using the default configuration.
This could of course be used to override or add any other configuration conditionally as well.