Last active
May 17, 2016 20:20
-
-
Save ovaris/a927892ccd72be502889a1484f0973ec to your computer and use it in GitHub Desktop.
post-checkout
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
#!/bin/bash | |
# | |
# Check package.json and npm install after git checkout. | |
# Put this to .git/hooks/post-checkout | |
# | |
PREVIOUS_HEAD=$1 | |
NEW_HEAD=$2 | |
BRANCH_SWITCH=$3 | |
if [ $(git diff $PREVIOUS_HEAD..$NEW_HEAD --name-only -- package.json | wc -l) == "1" ]; then | |
echo "[post-checkout] package.json changed" | |
npm prune && npm install | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment