I would like to be able to update subtrees automatically. I have one repo that consists solely of subtrees from third-party repos, and would like to use a post hook to update these whenever the main repo is pulled.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Just as a concern, in development of larger projects it's often important for dependent libraries to remain stable. If you constantly pull the changes automatically you don't have the opportunity to confirm that they don't come with breaking changes for your parent project.
If you're going to do the hook script, I recommend you only fetch but do not pull.
Fetch will update the local copy of the remote, but won't update your working branch to the head.
As for how to implement a hook script:
Here are a couple starting points:
- http://git-scm.com/book/en/Customizing-Git-Git-Hooks
- http://githooks.com/