[ACCEPTED]-Git Submodule to a subfolder-git-submodules
Git does not support partial checkouts, so 9 the submodule must point to a complete repository.
This thread on the Git mail list provides 8 some background information.
This article from Panther Software offers some 7 insight from someone else trying to accomplish 6 a similar goal (i.e. replicate svn:externals
using Git).
If 5 both projects are under your control, then 4 I suggest you isolate the "subfolder" that 3 you interested in to its own standalone 2 repo. Then both projects can create submodules 1 that link to it.
I'm running into the same issue. It doesn't 5 look solvable from a git level, at least 4 not in a way that lets you easily pull or 3 push to the parent repo.
However, you can 2 work around this limitation by using a simple 1 symlink:
- Set up your submodule in a separate directory.
git submodule add http://example.com/repo.git ./submodules/repo
- Create a symlink to the subfolder in the place you want:
ln -s ./submodules/repo/subdirectory ./wherever/symlinked_directory
References:
Usually when you're trying to extract a 8 subfolder of some other project, that subfolder 7 should be a separate project in the first 6 place, and both parent projects should be referring 5 to it.
You can extract such a subproject's 4 history using a tool like git subtree. Then you can 3 link the subtree back into your project 2 using either git submodule or git subtree, whichever 1 you prefer.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.