Git add all repositories under a certain path as submodules recursively
How can I add all sub-repositories inside a just-initialized git repository as submodules?
I have two repositories I've been tracking separately, now I want to take those into a larger project, but still keep their respective origins.
I currently just did git init
.
Also, if possible:
You can try something like:
find . -maxdepth 1 -type d -exec git submodule add ./{} ;
That should fail for regular folders, and succeed for folders which are nested git repo within your main repo you just initialized.
Once added, you will need to commit in your main repo, in order to record all the gitlinks you just created (with submodule add
).
Note that you would still have to update the url of those submodules you just added (because their current url would be their own folder)
链接地址: http://www.djcxy.com/p/92322.html上一篇: 在git中修改嵌套子模块的URL