Skip to content

Instantly share code, notes, and snippets.

@Powell-v2
Last active March 1, 2024 13:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Powell-v2/a06be9e59c50ab32b6255977787a25b7 to your computer and use it in GitHub Desktop.
Save Powell-v2/a06be9e59c50ab32b6255977787a25b7 to your computer and use it in GitHub Desktop.
Install any missing deps after merging in updates from remote.
# capture info messages and any errors in a log file
exec >> log/hooks-out.log 2>&1
if git diff-tree --name-only --no-commit-id ORIG_HEAD HEAD | grep -q 'package.json'; then
echo "$(date): reinstalling deps since package.json changed"
yarn > /dev/null
else
echo "$(date): no changes detected in package.json"
fi
# link is needed: ln -fv [script location] .git/hooks/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment