Post-Merge updating with drush on deployment module change

Nice little code that will check your site_deployment.install file and run drush dbup to update your site with deployment changes.

changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
 
check_run() {
        echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
  
# CD into drupal root (otherwise drush call will fail).
# This call *needs* to be here, after the changed_files have been retrieved in
# the command above.
DRUPAL_ROOT=/var/www/html-test/my-site/
cd $DRUPAL_ROOT
 
check_run site_deployment.install "drush updb -y"

little improved version, checking also CSS/JS files and running Grunt

changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
}

# CD into drupal root (otherwise drush call will fail).
# This call *needs* to be here, after the changed_files have been retrieved in
# the command above.
DRUPAL_ROOT=/var/www/html-test/my-site/
cd $DRUPAL_ROOT

check_run site_deployment.install "drush updb -y"

CSS_DRUPAL_ROOT=/var/www/html-dev/my-site/sites/all/themes/my_theme
cd $CSS_DRUPAL_ROOT

check_run ".scss|.sass|.js" "grunt"
check_run ".scss|.sass|.js" "drush cc css-js"

also add execute permissions to this hook with
chmod g+wx,a+x post-merge