Skip to content

Instantly share code, notes, and snippets.

@shunirr
Last active August 29, 2015 13:56
Show Gist options
  • Save shunirr/9110115 to your computer and use it in GitHub Desktop.
Save shunirr/9110115 to your computer and use it in GitHub Desktop.
git commit の時に名前が良い感じかどうか判定するやつ
#!/bin/bash
ORIGIN=$(git remote | grep origin | head -1)
NAME=$(git config --get user.name)
EMAIL=$(git config --get user.email)
if [ -n "$(git remote show ${ORIGIN} | grep 'github.com\|bitbucket.org')" ]; then
if [ "${NAME}" = "shunirr" -a "${EMAIL}" = "[email protected]" ]; then
exit 0
fi
echo "!!! COMMIT CANCELED !!!"
echo "!!! YOU SHOULD SET user.email AND user.name !!!"
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment