In order to differentiate your professional and personal email address when working on git repositories, here is how I proceeded.
Create a folder where you will drop the hooks that should apply to each repository.
And set the
core.hooksPath on this folder
git config --global core.hooksPath /path/to/my/centralized/hooks
The hook post-checkout is triggered when you change branch, and also on the
git clone. So it'll be executed for existing repo, and those you will clone later.
post-checkout file below to see what I put in.
Don't forget to add execution permission on your new hook :
chmod +x post-checkout
⚠ The core.hooksPath support is new in Git version 2.9.