Generally, I want my commits to use “sexycodingmachine@aol.net”.

Not for work, though. For those, I want to be “serious@responsible.com”.

Work Config

~/.gitconfig-work

[user]
	email = serious@responsible.com

Global Config

~/.gitconfig

[user]
	name = Your Name
	email = sexycodingmachine@aol.net

[includeif "gitdir:~/work-stuff/"]
        path = .gitconfig-work

Explanation

The global config is used generally. A conditional include is used when the directory matches, overwriting/augmenting values in the default config.

Now, based on the directory, git config will return different values, keeping my silly personal identity out of professional commit logs.