添加一个远程仓库项目https://github.com/RivTian/testSubmodule.git子模块到一个已有主仓库项目中。代码形式是git submodule add <url> <repo_name>, 如下面的例子: $ git submodule add https://github.com/RivTian/testSubmodule.git toolKit 这时,你会看到一个名为 toolKit 的文件夹在你的主仓库目录中。
默认情况下,子模块会将submodule放到一个与仓库同名的目录中, 如果你想要放到其他地方,那么可以在命令结尾添加一个不同的路径 此时其会在main-project文件夹下创建sub-project submodule,如下图 运行git status查看目前状态 $ git status On branch master Your branch is up to date with 'origin/master'. Change...
Your branchisup-to-date with'origin/master'. nothing to commit, working directory clean 这里提示,项目中没有任何需要提交的东西。下面,我们开始添加子模块: 命令如下:git submodule add 仓库地址 路径 ➜git submodule add git@github.com:diguage/child.git #添加子模块childCloning into'child'... remote...
git submodule init// 初始化子模块git submodule update// 更新子模块与主仓库中的子模块代码同步// orgit submodule update--init// or 嵌套的(子仓库中包含子仓库)git submodule update--init--recursive 2. 在主仓库更改子仓库代码并提交方法: 3. 更新、拉取子仓库代码方法: 父目录中: 代码语言:javascript...
在project1中push之后其实就是更新了引用的commit id,然后project1-b在clone的时候获取到了submodule的commit id,然后当执行git submodule update的时候git就根据gitlink获取submodule的commit id,最后获取submodule的文件,所以clone之后不在任何分支上;但是master分支的commit id和HEAD保持一致。 查看~/submd/ws/project1...
On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean 1. 2. 3. 4. 5. 6. 7. 这里提示,项目中没有任何需要提交的东西。下面,我们开始添加子模块: ➜ /Users/diguage/parent git:(master) git submodule add git@:diguage/child.git ...
Change to the submodule directory: Fetch changes from the upstream remote: Checkout the branch you want to update: Merge the changes from the upstream remote into your local branch: Commit the changes: Push the changes to the submodule's remote: ...
可以看到本地仓库由于第2/3/5/6小节的操作一共进行了4个commits,然后由于小节7的操作修改了README.md文件(等待git add操作)。 代码语言:javascript 代码运行次数:0 运行 AI代码解释 vfhky@vfhky-pc MINGW64 /e/plugins (master) $ git status On branch master Your branch is ahead of 'origin/master'...
git config -f .gitmodules submodule.[submodule-name].branch [branch-name] 如果不用 -f .gitmodules 选项,那么它只会为你做修改。但是在仓库中保留跟踪信息更有意义一些,因为其他人也可以得到同样的效果。 https://blog.csdn.net/weixin_44070450/article/details/107701812 ...