Created
May 26, 2016 19:25
-
-
Save jakemhiller/d342ad51505addf78ec628a16fd3280f to your computer and use it in GitHub Desktop.
git post-checkout hook for npm installing if package.json has changed between branches
This file contains hidden or 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 | |
changed_files="$(git diff-tree -r --name-only --no-commit-id $1 $2)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
} | |
check_run npm-shrinkwrap.json "npm prune && npm install" | |
# check_run package.json "npm prune && npm install" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment