個人作業簡報

作業環境

ana2016fall_08.7z mini2016fall.7z

在小組倉儲中設定組員為子模組的流程:

git clone 2016fallcadp_ag0 倉儲到近端

執行 git submodule add -b gh-pages https://github.com/name/組員倉儲 name 就可以將 組員 倉儲納入 g0 子目錄中, 且新增 .gitmodules 模組設定檔, 而且在 .git/config 與 .git/modules 目錄中新增子模組相關設定資料.

git clone 後執行 git submodule init, 啟始子模組, 然後利用 git submodule update 取下子模組的對應版本資料 (對應版本紀錄在 .git/modules/g100/refs/heads/master 檔案中.

假如帶有子模組的倉儲管理者, 希望更新某一子模組的對應版本, 則必須先確定倉儲分支, 然後 cd 到子模組目錄中, 利用 git pull 後, 然後回到上層倉儲進行版本的提交推送. 假如希望拉回所有子模組的對應版本內容, 則使用 git pull origin gh-pages --recurse-submodules

假如希望將所有子模組的對應版本更新到目前最新提交, 使用 git submodule foreach "(git checkout gh-pages; git pull)&"

當利用上述指令完成更新子模組的對應版本之後, 必須進行提交推送, 將改版資料送到遠端, 之後則透過 git submodule update --init --recursive 將此對應版本的子模組取到近端, 其中因為子模組中還有子模組, 而此更新對這些新加入的子子模組並沒有 --init, 因此下子模組更新時, 要納入 --init

在近端, 取下某一倉儲的所有資料, 包括子模組與子模組下的子子模組等:

git clone repos-url

cd repos_dir

git submodule update --init --recursive

或者直接

git clone --recursive repos-url