3

I need to only add a part (a directory) of another project within my "superproject", so I'd like to know if it is possible with git-submodule to only add a certain directory from another repository to my project?

(I'm using git for the deployment as well, so I do not want to stuff my project with other unnecessary things.)

Bernhard Vallant
  • 49,468
  • 20
  • 120
  • 148
  • [Howto extract a git subdirectory and make a submodule out of it?](http://stackoverflow.com/questions/920165/howto-extract-a-git-subdirectory-and-make-a-submodule-out-of-it); [Detach subdirectory into separate Git repository](http://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository) – hakre Jul 18 '11 at 14:28

1 Answers1

1

You could make a bare repo and then just use git checkout with the --work-tree and --git-dir parameter after the git command and specify the branch/tag you want and then specify the path you want after the -- file specifier option. Example:

git --git-dir=somedir --work-tree=someotherdir checkout somebranchortag -- somepath

Hope this helps.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141