Last Updated: February 25, 2016
· radmen

Run composer install after git merge

Put this to .git/hooks/post-merge:


git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD | grep composer.lock > /dev/null

if [ $? -eq 0 ]
  composer install

This script will check if composer.lock was modified, if yes composer install will by executed.
Also this snippet can be used as a post-checkout hook.

Notice that composer command must be available in your OS.