請注意,這將使超級項目/路徑/ //嵌套的Git倉庫,其SHA1仍將由父項目記錄。
要保持完全相同的狀態,您可以複製superproject/.git/modules/<module>
並重命名爲superproject/path/to/<module>
,並將<module>/<module>
重命名爲<module>/.git
。
然後你可以使用git submodule deinit
刪除子模塊:
mv asubmodule asubmodule_tmp
git submodule deinit -f -- a/submodule
rm -rf .git/modules/a/submodule
# if you want to leave it in your working tree
git rm --cached asubmodule
mv asubmodule_tmp asubmodule
我仍然希望的superprojec
一個子模塊,那麼它的.git
文件夾將是superproject/.git/modules/<module>
submodule absorbgitdirs
不會留下任何的選擇:
如果一個子模塊的git的目錄是子模塊內部,移動子模塊的git的目錄到其superprojects $GIT_DIR/modules
路徑,然後通過連接的git目錄及其工作目錄設置core.worktree
並添加一個.git
文件指向嵌入到superprojects git目錄中的git目錄。
我沒有在git config
中看到任何可能移動的配置$GIT_DI R/modules
。
absorbgitdirs
在commit f6f8586對Git的2.12(Q4 2016)
Its tests shows,預計使用GIT_DIR/modules
介紹。
較舊的Git(before Git 1.7.8,2011年10月)在子模塊文件夾中直接有.git
。
可能重複或與以下相關:https://stackoverflow.com/questions/1260748/how-do-i-remove-a-submodule – awiebe