Git Repo Auto-commit and Push

北城余情 提交于 2019-12-24 19:38:59

问题


I have a scenario where I have a repo where users access the files directly, they don't know git exists, and make changes to what are essentially text files.

I have that repo cloned. So when a commit is made, the changes are pushed to the cloned repo using the post-commit hook.

Now, I have the cloned repo as a bare repo. But, what I would like to do at this point is have a script run each time a push is made. That script would read the content of the file(s) that were just pushed. Is that treated as a commit? Can I again use the post-commit hook?

Can that be done on a bare repo? Since there is no working directory? I'm don't see how I could "read" the file if the repo is bare.


回答1:


Yes, you can use the hook. However, you must use lower level git command to retrieve the commit tree and files from a bare repo. E.g. http://git-scm.com/book/ch9-2.html



来源:https://stackoverflow.com/questions/14639299/git-repo-auto-commit-and-push

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