2011-03-28 26 views
3

我是GIT的新手,並且一直在努力。我有一個存儲在存儲庫中的網站。該網站需要一個設置爲單獨存儲庫的主題文件夾。將本地回購推送到遠程不會使用GIT推子模塊文件

我已經成功使用git submodule add命令將主題存儲庫添加到我的網站。

所以現在我有一個網站repro與主題子repro。子模塊的文件顯示在我的網站文件夾中。

我試圖推動整個主網站repro到遠程服務器工作,但主題(子模塊)的文件不推動。

+0

你的意思是「repo」而不是「repro」? – 2011-03-29 16:55:41

回答

2

該子模塊非常像獨立的存儲庫 - 它不知道它是否作爲子模塊包含在父存儲庫中。父庫不太瞭解子模塊 - 它應該在樹中的哪個位置,子模塊應該在哪個位置以及最初從哪個URL克隆它...

我不認爲還有,這將推動你的所有子模塊的命令 - 事件序列,當你更新輔助模塊的某些文件應該是:

cd theme 

# [Change or add some files, etc.] 

# Now commit those changes: 
git commit -a 

# Push them to the origin repository, assuming you're on the master branch: 
git push origin master 

# Change up to the parent repository: 
cd .. 

# Create a commit with the new version of that submodule: 
git add theme 
git commit -m "Committing a new version of the theme submodule" 

# Now push the commit that includes a pointer to the new submodule 
# version in the parent repository: 
git push origin master 

典型的問題這裏正在推動在引用一個子模塊的父版本庫提交版本,您尚未從子模塊版本推送。您可能會發現創建腳本以幫助您不會忘記任何這些步驟。

0

我只是將主題目錄添加爲遠程 - 而不是子模塊。在你自己的分支中管理文件的位置。主題的後續更新應移至正確的文件夾。

推送現在將按照您的初始設計進行操作。

希望這會有所幫助。