简体   繁体   English

将多个Git存储库推送到一个存储库

[英]Push multiple Git repositories to one repository

I'm not sure if this is even possible. 我不确定这是否可能。 However, let me ask. 但是,让我问。

Can I push from multiple repos to a single repo? 我可以从多个存储库推送到单个存储库吗? Essentially, I want the single repo to contain files from all the smaller repos. 本质上,我希望单个存储库包含所有较小存储库中的文件。

I have repos created for various modules of my project. 我已经为项目的各个模块创建了回购协议。 And the single repo is essentially the project itself. 单个仓库实际上就是项目本身。

As twalberg noted above, you can push from multiple repositories into a single destination, but that will create distinct history graphs. 正如上面的twalberg所述,您可以将多个存储库推送到一个目标位置,但这将创建不同的历史记录图。 You can merge them though and even in keep sync with Git's help using what is call in Git a Subtree Merge, as described in http://git-scm.com/book/ch6-7.html . 您可以合并它们,甚至可以使用Git中的子树合并功能与Git的帮助保持同步,如http://git-scm.com/book/ch6-7.html中所述 Take a look. 看一看。

I suppose you are trying to implement SVN workflow but it is not possible with git. 我想您正在尝试实现SVN工作流,但是git无法实现。

There are two suitable approaches: 有两种合适的方法:

  1. If your project is going to be loose coupled with your modules — use separate repository for your modules, and install it as a separate python packages (usual plugin system, like django plugins). 如果您的项目将与模块松散耦合-请为模块使用单独的存储库,并将其安装为单独的python软件包(通常是插件系统,如django插件)。
  2. Otherwise — use a single repository for project and modules. 否则-将单个存储库用于项目和模块。

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

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