Guest User

Untitled

a guest
May 27th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #/usr/bin/env bash
  2. # MIT © Sindre Sorhus - sindresorhus.com
  3.  
  4. # git hook to run a command after `git pull` if a specified file was changed
  5. # Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
  6.  
  7. changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
  8.  
  9. check_run() {
  10. echo "$changed_files" | grep --quiet "$1" && eval "$2"
  11. }
  12.  
  13. # Example usage
  14. # In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.
  15. check_run package.json "npm install"
  16. check_run bower.json "bower install"
Add Comment
Please, Sign In to add comment