The goal of this hook is to allow you catch when you're committing with an email you shouldn't on a public repositories. In some cases, certain companies need to seperate their internal coporate email accounts from those that might be used for committing to public repositories.
The UNWANTED_EMAIL_SUFFIX
should be the suffix (after the @
sign) of the email address you do not want to appear in the git logs. The DESIRED_AUTHOR_EMAIL
and DESIRED_AUTHOR_NAME
are the respective email and name you want to show up in the git logs.
To be used globally on all git projects:
# Set a git templates directory for all projects
git config --global init.templatedir '~/.git-templates'
mkdir -p ~/.git-templates/hooks
cp pre-commit ~/.git-templates/hooks
chmod a+x ~/.git-templates/hooks/pre-commit
or to be used only on specific projects:
cd <YOUR_PROJECT_DIRECTORY>
cp pre-commit ~/.git-templates/hooks
chmod a+x ~/.git/hooks/pre-commit