Created
February 24, 2021 06:16
-
-
Save imnnquy/b2858719ab0d6921f5cbf878d2606b5a to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
if [ -f .git/hooks/pre-commit ]; then | |
read -p "A pre-commit hook has been set up. Do you want to overwrite it? (y/n) " yn | |
case $yn in | |
[Yy]*) rm .git/hooks/pre-commit ;; | |
[Nn]*) exit ;; | |
esac | |
fi | |
if [ -f .git/hooks/commit-msg ]; then | |
read -p "A commit-msg hook has been set up. Do you want to overwrite it? (y/n) " yn | |
case $yn in | |
[Yy]*) rm .git/hooks/commit-msg ;; | |
[Nn]*) exit ;; | |
esac | |
fi | |
chmod +x git-hooks/pre-commit.sh | |
ln git-hooks/pre-commit.sh .git/hooks/pre-commit | |
chmod +x git-hooks/commit-msg.sh | |
ln git-hooks/commit-msg.sh .git/hooks/commit-msg | |
echo "Your pre-commit hook has been set up successfully" | |
chmod +x .git/hooks/pre-commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment