Last Updated: February 25, 2016
·
1.058K
· radmen

Run composer install after git merge

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

#!/bin/bash

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

if [ $? -eq 0 ]
then
  composer install
fi

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.