[英]Separate git repo for one folder in another git repo
This is my project folder structure. 这是我的项目文件夹结构。 I am using GitLab as my repo site.
我正在使用GitLab作为我的回购网站。 I am using Git
v2.17.1
. 我正在使用Git
v2.17.1
。
I have multiple such projects which have the same structure. 我有多个具有相同结构的此类项目。 In all of them, the
src
folder should be the same. 在所有这些文件中,
src
文件夹应相同。 Is it possible to create a separate git repo for src
and link it to this repo and the others? 是否可以为
src
创建一个单独的git repo并将其链接到该repo和其他仓库? How? 怎么样?
You can use git submodules . 您可以使用git子模块 。
What are Submodules? 什么是子模块?
The concept of submodules is brilliant. 子模块的概念很棒。 It essentially allows you to attach an external repository inside another repository at a specific path
从本质上讲,它允许您在特定路径下将外部存储库附加到另一个存储库中
How to use it? 如何使用它?
src
folder. src
文件夹创建一个单独的仓库。 src
repo to your every repo that use it: src
仓库添加到使用它的每个仓库中: git submodule add git@mygithost:src localpath/when/submodule/will/be
git submodule update --init --recursive
src
repo) use this command: src
repo)克隆存储库,请使用以下命令: git clone --recursive [URL to Git repo]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.