Skip to content

Instantly share code, notes, and snippets.

@jsleetw
Forked from hSATAC/update
Created December 16, 2011 05:04
Show Gist options
  • Save jsleetw/1484568 to your computer and use it in GitHub Desktop.
Save jsleetw/1484568 to your computer and use it in GitHub Desktop.
git update hook
#!/bin/sh
# place in {repo}/.git/hooks/update
# chmod +x update
name="$1"
old="$2"
new="$3"
user_name=$(git log -1 --pretty=format:%aN $new)
#branch=$(git rev-parse --symbolic --abbrev-ref $1)
branch=${name#refs/heads/}
if [ "$branch" == "master" ] || [ "$branch" == "staging" ]
then
if [ "$user_name" != "Kevin Luo" ]
then
echo "Username $user_name has no premission to commit branch [$branch]!"
exit 43
else
exit 0
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment