In my ~/.gitconfig, I list my personal email address under [user], since that\'s what I want to use for Github repos.
But, I\'ve recently s
With conditional includes in Git 2.13, it is now possible to have multiple user/email coexist on one machine with little work.
user.gitconfig has my personal name and email. work-user.gitconfig has my work name and email. Both files are at ~ path.
So my personal name/email applies by default. For c:/work/ dir, my work name/email is applied. For c:/work/github/ dir, my personal name/email is applied. This works as the last setting gets applied.
# ~/.gitconfig
[include]
path = user.gitconfig
[includeIf "gitdir/i:c:/work/"]
path = work-user.gitconfig
[includeIf "gitdir/i:c:/work/github/"]
path = user.gitconfig
gitdir is case-sensitive and gitdir/i is case-insensitive.
"gitdir/i:github/" would apply the conditional include for any directory with github in its path.