Git hooks - propagating from remote repository?

∥☆過路亽.° 提交于 2019-12-05 04:39:58

Git has no built-in support for transferring hooks between clones, optional or otherwise. It has default templates that you can modify or add to for new repositories, but those are pulled from the local filesystem (or network filesystem, as the case may be). It's possible that you could instrument a system for copying them, or put the hooks themselves into the repository and ask that developers configure their clone correctly.

It might also be possible to run the hook you want on the central bare repository, when the push happens but before the ref is updated. This could be done with a pre-receive or update hook. Whether this is acceptable depends on the actual functionality of this hook, which isn't clear from your post.

Reading http://www.reviewboard.org/docs/manual/dev/faq/ it sounds like maybe you should encourage your developers to use topic branches. Once changes are approved, they can be merged into release branches. You could have an update hook which only allows pushes to particular branches from privileged users, or any other criteria. This could also be done using Gitolite, which you can read about at http://progit.org/book/ch4-8.html

If you're not committed to Reviewboard, you might consider http://code.google.com/p/gerrit/ which is better integrated with Git and explicitly supports this workflow

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