Skip to content

Instantly share code, notes, and snippets.

@ara-ta3
Last active February 25, 2021 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ara-ta3/b654ffd330e2dff329109173a16c7346 to your computer and use it in GitHub Desktop.
Save ara-ta3/b654ffd330e2dff329109173a16c7346 to your computer and use it in GitHub Desktop.
git hook scripts
#!/bin/sh
current=$(git symbolic-ref HEAD|sed -e 's:^refs/heads/::')
if test $current = master; then
echo "masterブランチにcommitするなんてとんでもない!"
exit 1
fi
#!/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