如果你希望换个名字,或者换个路径(例如放在某个更深的目录下),也是允许的,需要后面增加个路径参数,例如git submodule add ...(仓库地址) src/B(你希望 submodule 位于的文件夹路径) submodule 的父子关系存在哪里 关系是保存在主项目的 Git 仓库中。 被当作 submodule 的 Git 仓库,其实不知道自己变成
Add submodules Clone project with submodules Get latest submodules Pull changes in Submodule Make changes to submodule Push changes to remote Reference 我们经常需要在项目A中使用其他项目B,项目B可能是第三方的库或者被多个项目共享的子项目。Git提供submodules来解决这个问题,通过在项目A中保留项目B的目录,这...
更新子模块:git submodule update 递归克隆整个项目submodule:git clone https://github.com/demo.git assets --recursive 递归更新整个项目submodule:git submodule foreach git pull 删除子模块:git rm --cached subModulesA rm -rf subModulesA --recursive表示递归地克隆git_parent依赖的所有子版本库。 git subtr...
Let’s start by adding an existing Git repository as a submodule of the repository that we’re working on. To add a new submodule you use thegit submodule addcommand with the absolute or relative URL of the project you would like to start tracking. In this example, we’ll add a library...
Git submodule功能可以让我们在一个仓库中添加另一个仓库作为当前仓库的子仓库,这样既方便了代码管理,也免去我们重复造轮子的精力和时间。注意:Git submodules 只是某个仓库某一时刻的一个状态的引用,即某个 commit 的引用。 添加子模块 添加远程项目默认分支 ...
1. git submodule add [path]: 这个命令用于添加子模块到你的项目中。需要提供子模块的仓库地址和相对于主项目的路径。例如,`git submodule add https://github.com/example/repo.git submodules/repo` 将仓库 `https://github.com/example/repo.git` 添加为主项目的 `submodules/repo` 子目录下的子模块。
gitclonexx.git--recurse-submodules 如果用的是 zsh,自带的 alias gcl='git clone --recurse-submodules',也就是用gcl xx.git就可以了。 一些文章提到的--recursive参数也是一样的作用。 初始化和更新 如果项目拉取时没有加上上面参数,那么需要手动初始化和更新。
git submodule是Git版本控制系统中的一个命令,用于管理仓库中的子模块。子模块是指在一个Git仓库中包含了另一个Git仓库的目录。 git submodule命令的使用方法如下: 1. 添加子模块:可以使用git submodule add命令将一个子模块添加到仓库中。例如,执行git submodule add <仓库URL> <子模块路径>来将指定URL的仓库作为...
git clone --recurse-submodules 父仓库地址 分开拉取: git clone 父仓库地址 git submodule init // 初始化子模块 git submodule update // 更新子模块与主仓库中的子模块代码同步 // or git submodule update --init // or 嵌套的(子仓库中包含子仓库) ...
Submodule blog 0000000...337eed9 (new submodule) 拉取包含submodule的仓库 方式一 如果给git clone命令传递--recurse-submodules选项,它就会自动初始化并更新仓库中的每一个子模块,包括可能存在的嵌套子模块。 git clone <repo> [<dir>] --recursive ...