Skip to content

Instantly share code, notes, and snippets.

View nikalas's full-sized avatar

nikalas

  • Sweden
  • 21:35 (UTC +02:00)
View GitHub Profile
@aaronhoffman
aaronhoffman / pre-commit
Created April 14, 2017 15:25
git hooks - prevent commit to local master branch and prevent push to remote master branch
#!/bin/sh
# prevent commit to local master branch
branch=`git symbolic-ref HEAD`
if [ "$branch" = "refs/heads/master" ]; then
echo "pre-commit hook: Can not commit to the local master branch."
exit 1
fi
exit 0