Last active
February 25, 2021 07:03
-
-
Save ara-ta3/b654ffd330e2dff329109173a16c7346 to your computer and use it in GitHub Desktop.
git hook scripts
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 | |
current=$(git symbolic-ref HEAD|sed -e 's:^refs/heads/::') | |
if test $current = master; then | |
echo "masterブランチにcommitするなんてとんでもない!" | |
exit 1 | |
fi |
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 | |
while read local_ref local_sha remote_ref remote_sha | |
do | |
if [[ "$remote_ref" =~ ^.*/(master)$ ]]; then | |
echo "$remote_ref にpushするなんてとんでもない!" | |
exit 1 | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment