Git 子项目?
我正在开发几个不同的 Joomla 附加组件,但希望将它们保留为单独的 git 存储库,因为它们有不同的开发团队(甚至组织)。但是,我还想将它们保留为共享相同 Joomla 基础的单个目录(被 .gitignore 忽略)。由于 Joomla 的结构,这可能有点复杂,因为它具有以下结构:
/joomla/
|--/administrator/
|--|--/components/
|--|--|--/component_a/
|--|--|--/component_b/
|--|--/language/
|--|--|--/en-GB/
|--|--|--|--/component_a_lang.ini
|--|--|--|--/component_b_lang.ini
|--/components/
|--|--/component_a/
|--|--/component_b/
|--/language/
|--|--/en-GB/
|--|--|--/component_a_lang.ini
|--|--|--/component_b_lang.ini
我知道我可以创建一个中央存储库并为每个子项目使用分支,并且要小心为正确的子项目使用正确的遥控器。但是有没有一种更简单的方法(子模块?)将所有子项目保留在同一目录中,这样如果我想复制整个内容进行测试,我就不必切换分支并使用复制面食?
I'm working on a couple of different Joomla add-ons but want to keep them as separate git repos as they have different development teams (and even organisations). However, I'd also like to keep them as a single directory sharing the same Joomla base (which is ignored by .gitignore). Because of Joomla's structure, this can be a bit complicated as it has the following structure:
/joomla/
|--/administrator/
|--|--/components/
|--|--|--/component_a/
|--|--|--/component_b/
|--|--/language/
|--|--|--/en-GB/
|--|--|--|--/component_a_lang.ini
|--|--|--|--/component_b_lang.ini
|--/components/
|--|--/component_a/
|--|--/component_b/
|--/language/
|--|--/en-GB/
|--|--|--/component_a_lang.ini
|--|--|--/component_b_lang.ini
I know I could make a central repo and use branches for each sub project and just be careful with using the right remote for the right subproject. But is there an easier way (submodules?) to keep all of the subprojects in the same directory so if I wanted to copy the whole thing for testing, I wouldn't have to switch branches and play with copy-pasta?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常我会建议使用子模块,但在这种情况下,由于项目的结构,它们并不真正合适。
子模块放置在单个目录中,因此您无法真正将它们分布在整个项目中。
一种可能的解决方案是将所有这些文件放在一个目录中,并使用符号链接将它们放在正确的位置。但这有几个缺点。您需要在每个存储库上重新创建所有符号链接,这也可能会给 Windows 用户带来问题。
Normally I would recommend using submodules, but in this case they're not really appropriate because of the structure of the project.
A submodule is placed in a single directory, so you can't really spread them out over the whole project.
One possible sollution would be to put all those files in one directory, and use symlinks to put them in the right place. But this has several drawbacks. You would need to recreate all the symlinks on each repository, and it can also cause problems for windows users.
正如 @Ikke 所说,代码跨目录传播的方式使得使用子模块来保存这些代码变得很麻烦。
我想我只会使用单独的分支来进行单独的开发。它们是“功能”,对吧?或多或少?因此,将它们视为功能分支可能相当合适。
如果您的中央存储库由 gitolite 提供服务,您可以在每个分支的基础上设置访问权限以分隔用户和组。你可以让每个人都可以阅读每个分支(对于测试很重要),但只有受祝福的组才能推送到他们自己的分支。
As @Ikke says, the way the code is spread across directories makes it cumbersome to use submodules to hold these.
I think I'd just use separate branches for the separate tracks of development. They're "features", right? More or less? So it's probably fairly appropriate to treat them like feature branches.
If your central repository is being served by gitolite, you can set up access on a per-branch basis to separate users and groups. You can make it so everyone can read every branch (important for testing), but only blessed groups can push to their own branch.