per company git config - 06-03-22

Started new job this week and I wanted to have a seprate email on my work related repos then my personal ones. Cool thing is git supports conditional config file includes!

~/.gitconfig

# per-user git config
[user]
name = Travis Shears
email = t@travisshears.com

[includeIf "gitdir:~/company-x/"]
  path = .gitconfig-company-x

~/.gitconfig-company-x

# Company X spefic git config
[user]
name = Travis Shears
email = travis.shears@company-x.com

Now any commits made under the directory ~/company-x will use the email travis.shears@company-x.com and not my personal email.

source

\- [ git ]