Skip to content

Instantly share code, notes, and snippets.

@radavis
Created March 2, 2019 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radavis/f5118eebd67b3cb2e664be2b9ac97303 to your computer and use it in GitHub Desktop.
Save radavis/f5118eebd67b3cb2e664be2b9ac97303 to your computer and use it in GitHub Desktop.
#!/bin/bash
git diff --name-only --cached | grep -q package-lock.json
pkglock_staged=$?
git diff --name-only --cached | grep -q package.json
pkgjson_staged=$?
if [[ "$pkglock_staged" -eq 0 && "$pkgjson_staged" -eq 1 ]]; then
echo "attempted commit of package-lock.json without changes to package.json!"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment