问题
Is there a way to notify people on change of some certain files? Specifically, I would like to track change of *.sql files and and notify our developers on a change. How can I configure post commit hooks to notify?
回答1:
If you want folks to get notified via email, and you want them to manage their own notifications, then https://app.github-file-watcher.com/ should do the trick - it monitors any public repo, and will notify you via email of changes to any file, a specific file, or some files that match your criteria.
回答2:
Use git diff-tree in your post-receive hook:
git diff-tree --name-status -rz
You can grep the result to check if certain files are modified (status 'M
'), as described in this answer.
you can find many examples on gist.github.com, with this one using the --name-status
option.
回答3:
I know it's been a while but I stumbled upon this thread when I was looking for something similar. I looked into Cooper's GitHub File Watcher but it didn't work with private repos nor was it open source.
So I just ended up building my own solution: https://github.com/jesalg/commit-hawk. Posting this here just in case someone is still looking for a tool like that.
来源:https://stackoverflow.com/questions/19169787/github-file-change-notification