Skip to main content

Make a folder in git repository a submodule

原本的 obsidian 是包在 Docusaurus 的 Project 裡面,現在想把他分割成一個 submodule 來管理。

參考:How to make an existing directory within a git repository a git submodule 可以完美解決。

create new git repository

remove the folder for submodule

git rm -r --cached .

new git

git init
git add origin xxx

add submodule to original git

git submodule add [email protected]:/newemptyrepo ./myproject/submodule-dir