简体   繁体   English

使用git版本控制超级/子项目

[英]Version controlling super/sub projects using git

I'm building a front-end framework, and in my current setup I have a development repo, a gem version, and a documentation app. 我正在构建一个前端框架,在当前设置中,我有一个开发仓库,一个gem版本和一个文档应用程序。 Currently, I have the app and the gem in subfolders within the dev repo, allowing my taskrunner to automate building everything at once, keeping everything in line. 目前,我在开发仓库中的子文件夹中有该应用程序和gem,这使我的taskrunner能够一次自动构建所有内容,并使所有内容保持一致。 I'm then manually copying the distribution versions of each to their respective repos. 然后,我将每个发行版本手动复制到各自的存储库。 What this means though, is an enormous master repo that's doing far too much, and other repos that I'm having to be very careful about ensuring are in line. 但是,这意味着一个巨大的主仓库正在做太多事情,而其他仓库我必须非常小心以确保符合要求。 It's becoming extremely unwieldy; 它变得非常笨拙。 errors are creeping in. 错误正在蔓延。

Ideally, I want to work on the development version, and for changes to propagate out to the other two repos - for example, maybe when I test, commit and push the dev repo, this could then trigger an update on the other two to bring the versions inline. 理想情况下,我想开发版本,并将更改传播到其他两个存储库-例如,也许当我测试,提交并推送开发存储库时,这可能会触发其他两个存储库的更新内联版本。 This would allow me to expand as/when needed - if I needed to add packages for other languages, I could build a new repo and add it into the project, and be confident it would work the same way. 这将允许我根据需要/在需要时进行扩展-如果需要添加其他语言的软件包,则可以构建一个新的存储库并将其添加到项目中,并确信它会以相同的方式工作。

I've tried submoduling, but this a. 我已经尝试过子调制,但是这个 seems to work in opposition to what I want, and b. 似乎与我想要的相反,并且b。 from past experience, git submodules are a nightmare to manage. 根据过去的经验,git子模块是管理的噩梦。

I've also tried having all the repos as folders within a parent, which has its own taskrunner that is in charge of cross-subproject concerns, but this is effectively the same what I have at the minute with a prettier structure; 我还尝试过将所有存储库作为文件夹放在父目录中,该目录具有自己的任务运行器,负责跨子项目的关注,但这实际上与我目前使用的漂亮结构相同。 I'm still left needing to push each subproject to an individual repo. 我仍然需要将每个子项目推送到一个单独的仓库中。

Gitslave looks as if it might be helpful, but I'm not quite sure how I can leverage it. Gitslave看起来似乎很有帮助,但是我不确定如何利用它。

Any advice specifically on this situation (or on how others have managed linked subprojects using git) would be really helpful. 专门针对这种情况(或其他人如何使用git管理链接的子项目)的任何建议都将非常有帮助。

  1. Submodules can not work " in opposition" in principle - just grok it better 子模块原则上不能“对立”工作-更好地进行调整
  2. Subtree in common is alternative for submodule in order to solve the same tasks, eliminate most of submodule's headaches (and don't touch standard Git-workflow, contrary to submodules) 子树的共同点是子模块的替代方案,以解决相同的任务,消除大部分子模块的麻烦(并且与子模块相反,不要碰到标准的Git工作流程)

Future reading and good use-case in details 未来阅读详细的好用例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM