Skip to content

Instantly share code, notes, and snippets.

@abdumu
Created February 25, 2018 02:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdumu/1f67dcb956e02e68a8e46a251ef0b3d9 to your computer and use it in GitHub Desktop.
Save abdumu/1f67dcb956e02e68a8e46a251ef0b3d9 to your computer and use it in GitHub Desktop.
git hook (.git/hooks/.post-merge) to run a command after `git pull` for laravel by @Abdu1M
##
# git hook to run a command after `git pull` for laravel by @abdu1m
##
# source: https://gist.github.com/sindresorhus/7996717
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
# npm
check_run package.json "npm install"
# composer
check_run composer.json "composer install"
#fixes and updates
npm run dev
composer dumpautoload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment