Search code examples
gitdvcsgit-submodules

Git Submodule to a subfolder


In svn you can link a repository to any folder in another svn repository. I'm wondering if there is a similar feature for git? Basically I want a git submodule inside my repository, but I want the submodule to be a pointer to a subfolder of another git repository, not the whole repository. Is this possible?


Solution

  • Git does not support partial checkouts, so the submodule must point to a complete repository.

    This thread on the Git mail list provides some background information.

    This article from Panther Software offers some insight from someone else trying to accomplish a similar goal (i.e. replicate svn:externals using Git).

    If both projects are under your control, then I suggest you isolate the "subfolder" that you interested in to its own standalone repo. Then both projects can create submodules that link to it.