Skip to content

Instantly share code, notes, and snippets.

View fael's full-sized avatar

Rafael Santos Sá fael

  • OLX
  • Lisbon, Portugal
View GitHub Profile
@fael
fael / post-checkout
Last active November 14, 2018 14:45 — forked from flesler/post-checkout
git hook to run a command after `git pull` and `git checkout` if a specified file was change for example, package.json
#!/usr/bin/env bash
# fork from https://gist.github.com/jakemhiller/d342ad51505addf78ec628a16fd3280f
changed_files="$(git diff-tree -r --name-only --no-commit-id $1 $2)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
check_run package.json "npm prune && npm install"