有哪些網(wǎng)站做國外生意的網(wǎng)絡(luò)服務(wù)器多少錢一臺
git 子倉庫
主倉庫中添加子倉庫
git submodule add <url> <path>
更新子代碼代碼
git submodule update --init
克隆含有子倉庫的倉庫
git clone --recurse-submodules <url>
主倉庫中刪除子倉庫
1、進(jìn)入包含子倉庫的父倉庫的根目錄
2、使用以下命令將子倉庫從父倉庫中移除(解除關(guān)聯(lián))
git submodule deinit <submodule_path>、
3、使用以下命令從 Git 倉庫中刪除子倉庫的記錄
git rm <submodule_path>
4、執(zhí)行 git commit 來提交父倉庫的修改
git commit -m "Remove submodule <submodule_path>"
5、最后,刪除實(shí)際的子倉庫文件。你可以手動刪除相關(guān)的子目錄,或者使用以下命令刪除子倉庫目錄:
rm -rf <submodule_path>
子倉庫 push 提交到 gerrit 出現(xiàn)沒有 change-id ?
由于子倉庫在 clone
后,倉庫的 .git
目錄中,沒有 hook/commit-msg
工具
所以在生成的 commit message
中,不會自動增加change-id
這會導(dǎo)致 commit
無法 push
到 gerrit
上走 review
的流程
請使用以下方法增加 commit-msg tool
到子倉庫的 .git
目錄中:
cd `awk '{printf $2}' .git`/hooks
wget http://192.168.0.202:8002/tools/hooks/commit-msg
chmod +x commit-msg
cd -
對于沒有 change-id
的 commit
可以使用 git commit --amend
或者 git rebase -i
重新增加 change-id
有了 change-id
后即可以順利 push
拉取子倉庫時(shí),避免重復(fù)輸入用戶名和密碼
git config --global http.postBuffer 524288000
在父倉庫根目錄中執(zhí)行
git submodule update --remote
該命令會根據(jù) .gitmodules 中每個(gè)子倉庫的分支,同步至遠(yuǎn)程倉庫對應(yīng)分支的最新節(jié)點(diǎn)。
(所以請確保 .gitmodules 每個(gè)子倉庫的分支名是正確的)