将克隆多个存储库合并到一个开发人员存储库中 [英] Git Clone Multiple Repository's into one developer repository

查看:119
本文介绍了将克隆多个存储库合并到一个开发人员存储库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置一个个人git存储库示例:jnew。在这个仓库里,我不想拥有许多其他仓库的克隆。例如,我有一个名为jnew的存储库,然后在那里我不想有一个名为depot的克隆。我在这方面的尝试如下。


  1. 创建版本库ex。 jnew

  2. 创建本地目录ex。 / User / jnew / development / jnew

  3. cd / User / jnew / development / jnew

  4. git init
  5. git remote添加 https://github.com/jnew/jnew.git
  6. >
  7. git clone --mirror https://github.com/jnew/depot。 git depot
  8. git remote add depot git@github.com:jnew / depot.git

  9. git co -b 1234-test depot / verified-next

除克隆部分外,这一切都可以使用。我希望克隆引入来自远程存储库的所有分支,所以在github上,我可以进入depot目录,然后分支查看最新的代码。由于某种原因,每次我尝试这个时候,远程分支都没有带上它。验证一个示例远程分支是主分支的副本。



任何帮助都将不胜感激。我在谷歌和这里搜索了几个小时,并没有找到答案,为什么克隆没有包含在其中的分支。



如果这没有意义那么你能否详细解释一个好方法?用git命令的意义在于你如何设置一个单独的开发者能够在他们自己的仓库中处理多个项目。这样做是为了避免错误推送到错误的版本库。

-scm.com/book/en/Git-Tools-Submodulesrel =nofollow> git-submodule 。子模块正在解决您的确切问题。


I am trying to setup a personal git repository example: jnew. Inside that repository I wan't to have many clones of other repository's. For example I have a repository called jnew and then inside there I wan't to have a clone called depot. My attempt at this was the following.

  1. Create repository ex. jnew
  2. Create local directory ex. /User/jnew/development/jnew
  3. cd /User/jnew/development/jnew
  4. git init
  5. git remote add https://github.com/jnew/jnew.git
  6. git clone --mirror https://github.com/jnew/depot.git depot
  7. git remote add depot git@github.com:jnew/depot.git
  8. git co -b 1234-test depot/verified-next

This all works except for the clone part. I would expect clone to bring in all branches from that remote repository so on github I could go into the depot directory then the branch to view the latest code. For some reason every time I try this the remote branches are not brought it. An example remote branch is verified which is a copy of the master branch.

Any help on this would be greatly appreciated. I have searched for hours on Google and here and have not found the answer as why the clone doesn't have the branches included in it.

If this is not making sense then can you explain a good approach in details. Meaning with git commands of how you would setups an individual developer to be able to work on multiple projects from within their own repository. This would be done to avoid mistakes pushing to the wrong repository.

解决方案

You need git-submodule. Submodules are solving the exact problem you have.

这篇关于将克隆多个存储库合并到一个开发人员存储库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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