post-checkout-hook

Git Hook Fails Silently

核能气质少年 提交于 2019-12-22 05:34:25
问题 I have a post-checkout and post-merge githook with these contents: #!/bin/bash # MIT © Sindre Sorhus - sindresorhus.com set -eux changed_files="$(git diff-tree -r --name-only --no-commit-id HEAD@{1} HEAD)" check_run() { echo "$changed_files" | grep --quiet "$1" && eval "$2" } echo '' echo 'running git submodule update --init --recursive if .gitmodules has changed' check_run .gitmodules "git submodule update --init --recursive" echo '' echo 'running npm install if package.json has changed'