2015-05-12 33 views
1

我有一個託管在包含子模塊的heroku上的應用程序。子模塊包含多個子模塊。子模塊以github回購的http地址形式存在。heroku在推後不更新submodules

app 
|- submodule1 
|- other dirs 

submodule1 
|- submodule2 
|- submodule3 
|- other dirs 

我做了幾個sobmodules的變化,然後提交一切(包括子模塊)並推送到github。我可以驗證,子模塊指向正確的提交,即回購可以通過git clone --recursive ...獲得。

當我推到github後,我推到了heroku。應用程序本身已更新,但子模塊保持不變(即使它們已被提交併推送到github)!

.gitmodules例子:

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

我該怎麼辦?這對我來說是嚴重的問題。

回答

1

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 

最後:

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

你做'在'submodule1'每個子模塊的git add',例如? Git將子模塊視爲其父項目中的文件。 –

+0

我其實錯過了一次提交,對於虛擬問題我很抱歉。至少現在我知道,heroku更新子模塊遞歸:)謝謝 – petrbel