Skip to content

Instantly share code, notes, and snippets.

@kovagoz
Created August 25, 2014 09:14
Show Gist options
  • Save kovagoz/47392c54c891c34407e6 to your computer and use it in GitHub Desktop.
Save kovagoz/47392c54c891c34407e6 to your computer and use it in GitHub Desktop.
Composer install on git checkout
#!/bin/bash
old_head="$1"
new_head="$2"
branch_switch="$3"
git_root=$(git rev-parse --show-toplevel)
git diff --name-only $new_head $old_head | grep composer.lock > /dev/null
if [ $? -eq 0 ] && [ $branch_switch -eq 1 ]; then
php $git_root/composer.phar install
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment