git子模块更新上游 [英] git submodule update upstream
问题描述
我有一个带有子模块的超级项目(Overleaf项目).我对子模块进行了更改,但是它们未显示在超级项目中.我想更新超级项目以反映对子模块的最新提交.我的理解是 git子模块更新
对该子模块起作用,以从超级项目中获取最新的提交,但是我该如何做相反的事情?
在超级项目中运行 git子模块更新--remote
时,它告诉我没有发现更改
首先,请确保使用最新的Git 2.31或更高版本,因为 git子模块
之前有问题,包括获取提交时的问题..>
第二,尝试指定要子模块跟踪的分支
cd/path/to/your/parent/repogit config -f .gitmodules子模块.
并确保您的子模块实际上是该分支的最新版本:
cd路径/到/您的/子模块git checkout -b分支--track原点/分支#如果master分支已经存在:git branch -u来源/主管理员
然后重试:
- 在另一个克隆的Overleaf存储库中进行新提交,然后将其推送
- 在超级项目中尝试
git子模块更新--remote
.
I have a super project with a submodule in it (Overleaf project). I have made changes to the submodule but they are not showing up in the super project. I want to update the superproject to reflect the latest commits to the submodule. My understanding is that git submodule update
acts on the submodule to fetch the latest commits from the super project but how do I do the reverse?
When in the superproject I run git submodule update --remote
it tells me no changes found
First, make sure to use the latest Git 2.31 or more, because git submodule
had some issues before, including when fetching commits.
Second, try and specify the branch you want your submodule to track
cd /path/to/your/parent/repo
git config -f .gitmodules submodule.<path>.branch <branch>
And make sure your submodule is actually at the latest of that branch:
cd path/to/your/submodule
git checkout -b branch --track origin/branch
# if the master branch already exist:
git branch -u origin/master master
Then try again:
- Make a new commit in an another cloned repository of Overleaf, and push it
- Try a
git submodule update --remote
in the super project.
这篇关于git子模块更新上游的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!