Skip to content

Instantly share code, notes, and snippets.

@rmandvikar
Created August 6, 2017 06:59
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 rmandvikar/5486d953fc74b60eba0b46a339f6a16a to your computer and use it in GitHub Desktop.
Save rmandvikar/5486d953fc74b60eba0b46a339f6a16a to your computer and use it in GitHub Desktop.
pre-receive hook with minor changes
#/bin/bash
# Copyright (c) 2016 G. Sylvie Davies. http://bit-booster.com/
# Copyright (c) 2016 torek. http://stackoverflow.com/users/1256452/torek
# License: MIT license. https://opensource.org/licenses/MIT
while read oldrev newrev refname
do
if [[ "$refname" == "refs/heads/master" ]]; then
MATCH=`git log --first-parent --pretty='%P' $oldrev..$newrev |
grep $oldrev |
awk '{ print \$1 }'`
if [[ "$oldrev" == "$MATCH" ]]; then
exit 0
else
echo 1>&2 "*** PUSH REJECTED! FOXTROT MERGE BLOCKED!!! ***"
exit 1
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment