Last active
December 25, 2015 01:39
-
-
Save drymek/6896918 to your computer and use it in GitHub Desktop.
Notification when switching to git branches with different composer.lock source: http://www.markbadolato.com/blog/2013/08/23/notification-when-switchin-git-branches/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# wget https://gist.github.com/drymek/6896918/raw -O /usr/share/git-core/templates/hooks/post-checkout | |
# chmod +x /usr/share/git-core/templates/hooks/post-checkout | |
# git init # to reload current git repository | |
PREV_COMMIT=$1 | |
POST_COMMIT=$2 | |
# MacOS Colors | |
NOCOLOR='\x1B[0m' | |
REDCOLOR='\x1B[37;41m' | |
# Linux Colors | |
#NOCOLOR='\e[0m' | |
#REDCOLOR='\e[37;41m' | |
if [[ -f composer.lock ]]; then | |
DIFF=`git diff --shortstat $PREV_COMMIT..$POST_COMMIT composer.lock` | |
if [[ $DIFF != "" ]]; then | |
echo -e "\n${REDCOLOR} $NOCOLOR"; | |
echo -e "${REDCOLOR} composer.lock has changed. You should run composer install $NOCOLOR"; | |
echo -e "${REDCOLOR} $NOCOLOR\n"; | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment