Skip to content

Instantly share code, notes, and snippets.

@imjakechapman
Created May 28, 2020 16:31
Show Gist options
  • Save imjakechapman/738ba69e5987ffe729f6926e15fd22be to your computer and use it in GitHub Desktop.
Save imjakechapman/738ba69e5987ffe729f6926e15fd22be to your computer and use it in GitHub Desktop.
Automatically npm install when package.json has changed when git pull
#/usr/bin/env bash
changed="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check() {
echo "$changed" | grep --quiet "$1" && eval "$2"
}
check package.json "npm install"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment