开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜