Skip to content

Instantly share code, notes, and snippets.

@altphi
Last active June 12, 2017 14:54
Show Gist options
  • Save altphi/366861ce7483ca92d20a98f0f9cc6222 to your computer and use it in GitHub Desktop.
Save altphi/366861ce7483ca92d20a98f0f9cc6222 to your computer and use it in GitHub Desktop.
post-merge git hook to create OSX alert when any package.json file changed
#!/usr/bin/env bash
# move this file to .git/hooks/post-merge
diff_results=$( git diff-tree --name-status -t -r --root HEAD@{1}..HEAD | grep -e '^M.*package.json$' )
[[ "$?" == "0" ]] && (
msg="display alert \"A package.json file changed! See list below.\" message \"${diff_results}\""
osascript -e "${msg}" >/dev/null &
)
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment