Skip to content

Instantly share code, notes, and snippets.

@Kphillycat
Created June 1, 2020 20:47
Show Gist options
  • Save Kphillycat/c404fe448cc25a49f6b08ea99293f491 to your computer and use it in GitHub Desktop.
Save Kphillycat/c404fe448cc25a49f6b08ea99293f491 to your computer and use it in GitHub Desktop.
Git Hook for npm installs
if git diff-tree --name-only --no-commit-id ORIG_HEAD HEAD | grep --quiet 'package.json'; then
echo "$(date): Running npm install because package.json changed"
npm install > /dev/null
else
echo "$(date): No changes in package.json found"
fi
# ln -fv ./post-merge .git/hooks/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment