Created
July 27, 2017 18:51
-
-
Save r4v/f81225e73ea135077c7418dbff1e4960 to your computer and use it in GitHub Desktop.
laravel post-merge hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# git hook to run some silly stuff after `git pull` AND if a specified file was changed | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
} | |
# Example usage | |
check_run package.json "npm install && npm run dev" | |
check_run composer.json "composer --dev install" | |
check_run test "phpunit" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment