How to clone only a folder from a git submodule?

前端 未结 3 541
孤独总比滥情好
孤独总比滥情好 2020-12-24 10:24

I\'m trying to get just a folder from an external github repo to use in my project.

I want my project setup to be like this:

-my_project
    -submodu         


        
3条回答
  •  感动是毒
    2020-12-24 10:37

    If you:

    git submodule add http://github.com/user/submodule.git
    

    directly under my_project, you should end up with the desired organization of directories.

    From git submodule add man page:

    The optional argument is the relative location for the cloned submodule to exist in the superproject.
    If is not given, the "humanish" part of the source repository is used ("repo" for "/path/to/repo.git" and "foo" for "host.xz:foo/.git").

提交回复
热议问题