Skip to content

Instantly share code, notes, and snippets.

@oker1
Forked from lyrixx/post-checkout
Last active December 21, 2015 01:49
Show Gist options
  • Save oker1/6230448 to your computer and use it in GitHub Desktop.
Save oker1/6230448 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Put this file at: .git/hooks/post-checkout
# and make it executable
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587
PREV_COMMIT=$1
POST_COMMIT=$2
NOCOLOR="\x1B[0m"
REDCOLOR="\x1B[37;41m"
if [[ -f composer.lock ]]; then
DIFF=`git diff --shortstat $PREV_COMMIT..$POST_COMMIT composer.lock`
if [[ $DIFF != "" ]]; then
echo -e "$REDCOLOR composer.lock has changed. You must run 'php composer.phar install'$NOCOLOR"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment