Last active
February 27, 2017 16:21
-
-
Save sgnh/2d1d3fd56b5d4cf672a897d9533b1946 to your computer and use it in GitHub Desktop.
Git post-checkout hook for reinstalling yarn packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PREVIOUS_HEAD=$1 | |
NEW_HEAD=$2 | |
BRANCH_SWITCH=$3 | |
changed_files="$(git diff-tree -r --name-only --no-commit-id $PREVIOUS_HEAD $NEW_HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
} | |
check_run yarn.lock "yarn" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment