Git configuration using conditional imports
It is possible to include a git configuration for a particular context (directory, branch name...). For example, override the username and email in a directory and all its subfolders.
# ~/.gitconfig
[includeIf "gitdir:~/workspace/perso/"]
path = ./.gitconfig_perso
# ...
# ~/.gitconfig_perso
[user]
name = Steven DUBOIS
email = perso@email.com
Now, when I work in the ~/workspace/perso
directory, my username and email match the values in .gitconfig_perso
config file.
More information on the documentation.