Git仓库在git仓库中 [英] Git repository in a git repository

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

问题描述

  repo1 / 
.git /
我有一个包含git存储库的git存储库。文件
repo2 /
.git /
文件
文件

可以使用这个架构吗?

解决方案

您可以嵌套git仓库:

父回购将简单地忽略嵌套回购



jleedev 评论,并用这个要点脚本说明父代回购
将通过轨道嵌套回购状态 gitlink
(gitlink =对象的SHA-1引用另一个仓库中的提交。Git链接只能通过SHA或通过提交标记。

gitlink有一个特殊的模式' 160000 ',用于子模块,但也存在于简单的嵌套仓库中。 b
$ b

但是,通常的命令不会承认嵌套的repo: add commit 只适用于一个回购,而不适用于其他回购。



GIT中的子模块将允许从父回购引用嵌套回购,并保持儿童回购的精确参考。



另一种选择涉及:


  • 两个单独的Git仓库(不嵌套)
  • 从一个符号链接到一个特定其他部分(包括Unix,也包括Windows Vista +都有符号链接)


I have a git repository including a git repository.

repo1/
     .git/
     files
     repo2/
          .git/
          files
     files

Is it possible to work with this architecture ?

解决方案

You can have nested git repos:
The parent repo will simply ignore nested repo.

jleedev comments and illustrates with this gist script that the parent repo would track the nested repo state through a gitlink.
(gitlink = SHA-1 of the object refering to a commit in another repository. Git links can only be specified by SHA or through a commit mark.
A gitlink has a special mode '160000', used for submodules, but also present for simple nested repos).

However, usual commands would not acknowledge the nested repo: add or commit would apply only in one repo, not the other.

git submodule would allow to reference the nested repo from the parent repo, and keep an exact reference of the child repo.

Another alternative could involve:

  • two separate Git repos (not nested)
  • a symlink from one to a specific part of the other (both Unix, but also Windows Vista+ have symlinks)

这篇关于Git仓库在git仓库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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