Want Git post receive hook to detect certain file types

▼魔方 西西 提交于 2019-12-24 15:11:00

问题


I would like my post-receive hook to run a certain script whenever files of a certain type, *.hbm.xml are pushed to the server. Motivation: I want to rev my database schema version number whenever NHibernate files are changed.

Thanks!


回答1:


This is what I came up with:

for i in `git show --pretty="format:" --name-only HEAD | grep '.*\.hbm\.xml' `; do
    # call script here.....
    exit
done


来源:https://stackoverflow.com/questions/5939109/want-git-post-receive-hook-to-detect-certain-file-types

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!