Skip to content

Instantly share code, notes, and snippets.

@ianaya89
Created September 17, 2015 03:04
Show Gist options
  • Save ianaya89/040734b1587bb17eb390 to your computer and use it in GitHub Desktop.
Save ianaya89/040734b1587bb17eb390 to your computer and use it in GitHub Desktop.
Git hook that will install npm dependecies (if package.json changed) after a git pull.
#!/bin/sh
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
check_run package.json "npm install"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment