Multiple git configs

The other week I was looking for a way to get my git config to work like I want on my work machine. I wanted it to use different e-mail addresses based on what folder the repo was it. My setup is simple: ~/Code and .emacs.d is where my personal stuff lives and all the work stuff is in ~/KnowitCode.

The reason they are seperated is that my personal stuff is in Git and synced over Dropbox. And I'm not allowed to have work code on non work machines. So this is how it is set up.

Then I found this blog post, describing how you can configure git to override a default config based on paths. It solved all my problems in a great way. I don't even have to think about it.