有人真的使用git超级/子项目吗? [英] Is anyone really using git super/subprojects?

查看:260
本文介绍了有人真的使用git超级/子项目吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人在真实项目中使用新的git super / subproject功能?它有多好?例如,我明白,如果我推到一个子项目,我不得不手动调用超级项目的钩子(也许使用子项目钩子,但不过)?

解决方案通过使用子模块,您正在您的Git工作空间(意味着您的超级项目Git存储库)定义配置
通过配置意思是在你的工作空间中工作所必需的标签或SHA-1节点列表。
(以及工作,我的意思是你在工作空间内进行的任何开发工作:经典编译或补丁,或者合并,部署,或者......)。
当你克隆一个超级项目并且 git update 时就是这种情况。您的子模块:您正在检查以前在超级项目中提交的确切回购SHA1(记录为 gitlink 索引)。



另一种模式是当您在一个或多个子模块上处理超级项目

这意味着,对于给定的子模块,您已检出特定分支(对于子模块的内容,您不再使用分离的HEAD,而是使用指向分支尖端的指针)。

然后,推送子模块意味着更新远程存储库,其中包含子模块(只有那一个)。



最后一个场景中的实际技巧(可能值得你想要一个钩子)是当你推动super -project:您需要确保先推送所有子模块。



子模块教程
$ b


在发布变更之前始终发布子模块更改引用它的超级项目。如果您忘记发布子模块更改,其他人将无法复制(超级项目的)存储库


Don忘了你可以配置子模块来关注分支


Is anyone using the new git super/subproject feature in real projects? How well does it work? For instance, I understand that if I push to a subproject I have to manually call superprojects hooks (maybe using the subprojects hook, but nevertheless)?

解决方案

By using submodule, you are defining in your Git workspace (meaning your "super-project" Git repository) a configuration.
By "configuration", I mean "the list of tags or SHA-1 node necessary to work in your workspace".
(and by work, I mean whatever "development effort" you are doing within your workspace: classic compilation, or patch, or merge, or deployment, or...).
That is the case when your are cloning a super-project and "git update" your submodules: you are checkouting the exact repos SHA1 which were previously committed in the super-project (recorded as gitlink in the index).

The other mode is when you are working on your super-project and on one or more submodules.
That means, for a given submodules, you have checked out a specific branch (you are no longer using a detached HEAD for the content of that submodules, but rather a pointer to the tip of a branch).
Then, "pushing a submodule" means updating a distant repository containing that sub-module (and only that one).

The actual trick in that last scenario (which could deserve a hook of you want one) is when you are pushing the super-project: you need to be sure to have pushed all your sub-modules first.

From the submodule tutorial:

Always publish the submodule change before publishing the change to the superproject that references it. If you forget to publish the submodule change, others won't be able to clone the repository (of the super-project)

Don't forget you can configure a submodule to follow a branch.

这篇关于有人真的使用git超级/子项目吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆