heroku在推送后不更新子模块

时间:2020-12-28 00:08:40

I have an app hosted on heroku contaiting a submodule. The submodule contains multiple submodules. The submodules are in form of http address to github repo.

我在heroku上托管了一个包含子模块的应用程序。子模块包含多个子模块。子模块采用http地址到github repo的形式。

app
 |- submodule1
 |- other dirs

submodule1
 |- submodule2
 |- submodule3
 |- other dirs

I made changes in several sobmodules then commited everything (including submodules) and pushed to github. I can verify, that submodules point to the correct commits i.e. a repo may be obtained via git clone --recursive ....

我在几个sobmodules中做了更改然后提交了所有内容(包括子模块)并推送到github。我可以验证,子模块指向正确的提交,即可以通过git clone获得repo --recursive ....

After I pushed to github, I pushed to heroku. The app itself updated, nevertheless the submodules remained the same (even though they are commited and pushed to github)!

在我推送到github后,我推到了heroku。应用程序本身已更新,但子模块保持不变(即使它们被提交并推送到github)!

Example of .gitmodules:

.gitmodules的示例:

[submodule "src/main/java/runtime"]
    path = src/main/java/runtime
    url = https://github.com/USER/REPO.git

What should I do? This is serious problem for me.

我该怎么办?这对我来说是个严重的问题。

1 个解决方案

#1


Git treats a submodule like a separate repository with regard to pushing to a remote. The correct procedure here would be to push each submodule, then push the submodule containing the submodules, and finally push your root project. So you would want to do something like this:

Git将子模块视为推送到远程的单独存储库。这里正确的过程是推送每个子模块,然后推送包含子模块的子模块,最后推送你的根项目。所以你想要做这样的事情:

cd app/submodule1/submodule2/
git commit -m                  # commit files in submodule2
git push                       # push to repository

...                            # do the same for all other submodules in submodule1

cd app/submodule1/
git commit -m                  # commit files in submodule1
git push                       # push to repository

And finally:

cd app/                        # change to directory of main project
git commit -m                  # commit files in main project
git push                       # after this everything will be up to date

#1


Git treats a submodule like a separate repository with regard to pushing to a remote. The correct procedure here would be to push each submodule, then push the submodule containing the submodules, and finally push your root project. So you would want to do something like this:

Git将子模块视为推送到远程的单独存储库。这里正确的过程是推送每个子模块,然后推送包含子模块的子模块,最后推送你的根项目。所以你想要做这样的事情:

cd app/submodule1/submodule2/
git commit -m                  # commit files in submodule2
git push                       # push to repository

...                            # do the same for all other submodules in submodule1

cd app/submodule1/
git commit -m                  # commit files in submodule1
git push                       # push to repository

And finally:

cd app/                        # change to directory of main project
git commit -m                  # commit files in main project
git push                       # after this everything will be up to date