Skip to content

Instantly share code, notes, and snippets.

@coderabbi
Created December 18, 2017 11:27
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save coderabbi/201cd84a7c273d535be9511fb9055238 to your computer and use it in GitHub Desktop.
Save coderabbi/201cd84a7c273d535be9511fb9055238 to your computer and use it in GitHub Desktop.
'composer install' git post-merge hook
# .git/hooks/post-merge
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
composer_install_on_changed_lockfile() {
echo "$changed_files" | grep --quiet "composer.lock" &&
echo "Changes to 'composer.lock' detected; running 'composer install'." &&
composer install
}
composer_install_on_changed_lockfile
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment