创建一个包含另一个git仓库的git仓库 [英] Create a git repository that contains another git repository

查看:767
本文介绍了创建一个包含另一个git仓库的git仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个纯粹的git repo(让它称为repo#1)并克隆它。




  • 在克隆(repo#2)中,我创建了几个文件夹,其中一个我决定做一个git repo(回购# 3)。

  • 当我提交repo#2时,所有内容都按预期运行,以免忽略回购#3(.git文件夹和文件提交)。



如何将回购#3添加到回购#2中,以便当我将回购#2推回回购#1时,我还可以访问repo#3的历史记录等单独的repo#1克隆。换句话说,就是我们可以访问repo#3的历史记录等。

换句话说。如何创建一个包含其他git存储库的git存储库?

解决方案

您不应该那样做。 .git /下的元数据在repo生命周期中发生变化,并且这些变化并不一定意味着应该提交的内容变化:简单 git repack 更改.git下的文件,不应该改变。你为什么想这样做?


I have created a bare git repo (lets call it repo #1) and cloned it.

  • In the clone (repo #2) I have created several folders, one of which I have decided to make a git repo (repo #3).
  • When I commit to repo #2, everything runs as expected exept that repo #3 is ignored (the .git folder, the files commit).

How can I add repo #3 to repo #2 so that when I push repo #2 to repo #1, I can make a seperate clone of repo #1 in which I can also access the history etc. of repo #3?

In other words. How do I create a git repository that contains another git repository?

解决方案

You shouldn't do that. Metadata under .git/ is changed during repo lifetime and that changes not necessarily mean "changes in the content" that should be committed: simple git repack changes files under .git but that changes should not be committed. Why do you want to do that?

这篇关于创建一个包含另一个git仓库的git仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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