Assuming your work repositories are inside the ~/Projects/Acme
folder.
-
First, create a separate Git config:
git config -f ~/Projects/Acme/.gitconfig user.email "john.doe@acme.org" git config -f ~/Projects/Acme/.gitconfig user.name "John Doe"
-
Then, create
~/.gitconfig.local
:[includeIf "gitdir:~/Projects/Acme/"] path = ~/Projects/Acme/.gitconfig
cd ~/dev/repo
git config user.email "john.doe@acme.org"
git config user.name "John Doe"