How do I pull a git submodule from separate project?
Let's keep things simple shall we?
I have a git project set up. Let's call it ProjectA. My friend has another, older git project set up, called ProjectB. In ProjectB, he has two submodules, SubOne and SubTwo, set up. Now, when I mean "set up", I mean he can just "git submodule update" them. They exist.
Now, being selfish, I want to steal his submodules (I'm not really stealing, he's giving them to me).
Is there a way I can, in my ProjectA, pull only his submodules? If so, how? Also, since we're working on sister projects, the file structure has to remain the same. In o开发者_开发技巧ther words, his files are under ext/SubOne and ext/SubTwo, and my files need to be the same.
One last thing; he knows how to create submodules, but we no longer have the url for it.
Grazie! NS
Yes, you can make his submodules submodules within your repository. It's quite easy, once you have the URLs for servers where these repositories live.
Have you tried getting the URL for the submodules by using the git config --list command? Run this within his repository. You'll see something like :
submodule.lib.url=(url_to_submodule)
He could also push the submodule repositories to an external server, so that you'd have access to them.
Once you have the URL, it's easy:
git submodule add <url_to_submodule> <sub-directory>
精彩评论