比方說,我有一個父回購myproject
,並呼籲submodule
一個單獨的回購協議,目錄結構是這樣的以下內容:提交更改到一個子模塊,而無需提交母公司回購
root$ find . -not -path *.git* . ./myproject ./myproject/submodule
現在我想補充submodule
作爲myproject
的子模塊。
root$ cd myproject myproject$ git submodule add git://url-to-submodule:submodule.git submodule Adding existing repo at 'submodule' to the index
現在,假設我改變了一些東西到submodule
。
myproject$ cd submodule submodule$ touch herpin.txt submodule$ add herpin.txt submodule$ git commit -am "i'm herpin and i'm derpin"
在這一點上,我回去給家長資源庫,並檢查git的狀態:
submodule$ cd .. myproject$ git status # On branch master # Changes not staged for commit: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # # modified: submodule (new commits) # no changes added to commit (use "git add" and/or "git commit -a")
好,該死的 - 現在每一次我犯子模塊的東西,我也有提交父母。
如果您有更復雜的子模塊樹,它會很快變得煩人。假設 - 4層深。如果我在最內層的子模塊上做出改變,我必須承諾它的母公司,祖父母,曾祖父母和偉大父母。這是一個驚人的痛苦---。
必須有更好的方法! (不,沒有嵌套如此多的層次不是一個選項:/這不是我的要求......)沒有一種方式可以讓git-commit通知父庫提交的內容嗎?