Checking out only a subdirectory of another repo with git-submodule
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 deplo开发者_如何学编程yment as well, so I do not want to stuff my project with other unnecessary things.)
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.
精彩评论