Skip to content

Instantly share code, notes, and snippets.

@ahmadazimi
Last active December 31, 2017 10:56
Show Gist options
  • Save ahmadazimi/32fbb5788250120d0343 to your computer and use it in GitHub Desktop.
Save ahmadazimi/32fbb5788250120d0343 to your computer and use it in GitHub Desktop.
Git post-receive hook to update submodules and run composer install
#!/bin/bash
# Place this file in .git/hooks/ directory.
# Update the working tree after changes have been pushed here
cd ..
env -i git checkout -f
env -i git submodule update --init --recursive
# Check if a composer.json file is present
if [ -f composer.json ]; then
# Install or update packages specified in the lock file
composer install --no-dev --optimize-autoloader
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment