Last Updated: February 25, 2016
·
1.33K
· 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.

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside