mangoweb.net

Git: setting different identities per directory

Git users with multiple identities – for ex. work vs personnal projects – rejoice, there is now an easy way to set different user.email & user.name per directory structure: use a conditional include in your global .gitconfig

[includeIf "gitdir:/path/to/your/work/top/dir/"]
  path = /path/to/your/work/top/dir/customconf.inc

All projects under that directory will pick up user config set in the custom conf overriding the thus global one.

See https://git-scm.com/docs/git-config#_conditional_includes
I think it’s since Git 2.13