亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

提取所有git子模塊中最新模塊的簡單方法

提取所有git子模塊中最新模塊的簡單方法

Git
慕的地8271018 2019-06-29 11:24:57
提取所有git子模塊中最新模塊的簡單方法我們使用git子模塊來管理兩個大型項目,這些項目依賴于我們開發的許多其他庫。每個庫都是一個單獨的REPO,作為一個子模塊引入到依賴項目中。在開發過程中,我們通常只想獲取每個依賴子模塊的最新版本。GIT有一個內置的命令來做這件事嗎?如果不是,那么Windows批處理文件或類似的文件如何?
查看完整描述

3 回答

?
慕村9548890

TA貢獻1884條經驗 獲得超4個贊

如果是第一次你需要用一個回購工具來結帳--init第一:

git submodule update --init --recursive

GIT 1.8.2或高于選項--remote添加以支持對遠程分支的最新提示進行更新:

git submodule update --recursive --remote

這有一個額外的好處,即尊重.gitmodules.git/config文件(如果您碰巧有任何文件,缺省值是原產地/母版,在這種情況下,這里的其他一些答案也會起作用)。

GIT 1.7.3或者在上面您可以使用(但下面的問題仍然適用于更新):

git submodule update --recursive

或:

git pull --recurse-submodules

如果您想要將您的子模塊拉到最新的提交,請將回購所指向的內容進行提交。

看見Git-子模(1)詳情


查看完整回答
反對 回復 2019-06-29
?
MMTTMM

TA貢獻1869條經驗 獲得超4個贊

如果需要將子模塊的內容拖到子模塊存儲庫中,請使用

git pull --recurse-submodules

Git在1.7.3中第一次學到的特性。

但這將不能檢出子模塊中的正確提交(主存儲庫所指向的提交)。

若要簽出子模塊中的正確提交,應在拉動后更新它們。

git submodule update --recursive --remote


查看完整回答
反對 回復 2019-06-29
?
慕桂英4014372

TA貢獻1871條經驗 獲得超13個贊

在init上運行以下命令:

git submodule update --init --recursive

在gitrepo目錄中,最適合我。

這將拉出所有最新的包括子模塊。

解釋

git - the base command to perform any git command
    submodule - Inspects, updates and manages submodules.
        update - Update the registered submodules to match what the superproject
        expects by cloning missing submodules and updating the working tree of the
        submodules. The "updating" can be done in several ways depending on command
        line options and the value of submodule.<name>.update configuration variable.
            --init without the explicit init step if you do not intend to customize
            any submodule locations.
            --recursive is specified, this command will recurse into the registered
            submodules, and update any nested submodules within.

在此之后,您只需運行:

git submodule update --recursive

在gitrepo目錄中,最適合我。

這將拉出所有最新的包括子模塊。


查看完整回答
反對 回復 2019-06-29
  • 3 回答
  • 0 關注
  • 2362 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號