gpt4 book ai didi

git - 修改了 git submodule 中的内容,但 git submodule 说是最新的

转载 作者:太空狗 更新时间:2023-10-29 13:55:38 26 4
gpt4 key购买 nike

我无法推送我对 git 子模块所做的更改。我已经推送了主项目,得到了这个

mainProject$ git status
On branch myBranch
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)

modified: example/submod (modified content)

no changes added to commit (use "git add" and/or "git commit -a")

但是当我试图在子模块中推送更改时,我得到了

submod$ git status
On branch dev
Your branch is up-to-date with 'origin/dev'.

git --version 的输出是

git version 1.9.3 (Apple Git-50)

当我运行时

mainProject$ git diff example/submod
Submodule example/submod contains modified content

这里发生了什么?我也无法添加来自主项目的更改

mainProject$ git add example/submod
mainProject$ git status
On branch myBranch
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)

modified: example/submod (modified content)

no changes added to commit (use "git add" and/or "git commit -a")

最佳答案

您在子模块中 checkout 的提交与在主存储库中提交的提交不同。您可以通过

检查子模块的关联提交
git submodule update

...或者您添加此子模块,提交并使用当前更改推送它:

git add example/submod
git commit -m 'new commits in submodule'
git push origin myBranch

关于git - 修改了 git submodule 中的内容,但 git submodule 说是最新的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27942999/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com