2017-03-16 56 views
1

我有一個父回購A和子模塊回購B,它在主人的最新提交時簽出。我已經在repo A中運行了git submodule update --init --recursive,所以我的子模塊已經在它裏面了。我知道我可以在該命令上拋出一個--remote標誌,讓它從最新的提交中更新,但我無法弄清楚的是如何更改子模塊提交#,以便每當其他人運行git submodule update --init --recursive時,它將從子模塊中的最新提交中更新。有任何想法嗎?謝謝。如何配置父回購從子模塊的頭更新?

回答

0

git submodule update --init --recursive,它也將從子模塊中的最新提交更新。

否,該命令僅檢查出在被記錄gitlinkspecial entry in the parent repo)子模塊。

你需要(內拉的git子模塊日)添加--remote迫使分支更新
但是要記住,任何子模塊將被更新,如果沒有​​在.gitmodules發現拖欠其上游主分支。
請參閱「Git: track branch in submodule but commit in other submodule (possibly nested)」。

0

解決方式:

1)CD插入子模塊 2)自上次更新子模塊有我的一個承諾,這不是最新的,我剛剛簽出最新的提交(git checkout [commit_hash]) 3)CD在那裏,回到父回購 4)git add submodule - > commit - > push

+0

你不需要:如果你的子模塊設置爲跟蹤一個分支(就是說如果它有一個' submodule。''.gitmodules')'--remote'就足夠了。 – VonC