Skip to content

Instantly share code, notes, and snippets.

@jlabs
Last active January 20, 2025 12:12
Show Gist options
  • Save jlabs/6989c9b0de088cea5e3e4380ab3d4cb2 to your computer and use it in GitHub Desktop.
Save jlabs/6989c9b0de088cea5e3e4380ab3d4cb2 to your computer and use it in GitHub Desktop.
Git hook for DDEV + Craft CMS changes on git pull
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
check_run composer.json "composer install"
check_run package.json "npm i"
check_run "/config/project/" "php craft project-config/apply"
@jlabs
Copy link
Author

jlabs commented Jan 20, 2025

Copy to .git/hooks/ as post-merge file. It then runs whenever commits are pulled and checks for changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment