Last active
February 5, 2020 23:35
-
-
Save ShaneQi/12cdd0ac8fee1782e156384884497fe1 to your computer and use it in GitHub Desktop.
git pre-commit hook for checking author name & email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The tutorial of setting this up: | |
// https://coderwall.com/p/jp7d5q/create-a-global-git-commit-hook | |
if [[ $(git remote) =~ "origin" ]] | |
then | |
if [[ $(git config user.name) != "Shane Qi" ]] | |
then | |
echo "Incorrect author name." | |
exit 1 | |
fi | |
if [[ $(git remote get-url origin) =~ "github.com" ]] | |
then | |
if [[ $(git config user.email) != "qizengtai@gmail.com" ]] | |
then | |
echo "Incorrect author email." | |
exit 1 | |
fi | |
fi | |
if [[ $(git remote get-url origin) =~ "axxess.net" ]] | |
then | |
if [[ $(git config user.email) != "zqi@axxess.com" ]] | |
then | |
echo "Incorrect author email." | |
exit 1 | |
fi | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment