Using someone else's repo as a Git Submodule on GitHub

前端 未结 1 1364
长发绾君心
长发绾君心 2020-12-07 11:11

I am trying to find out if it is possible to use someone else\'s repository (or branch of a repository) as a Submodule in your own Git repository. Documentation on github it

相关标签:
1条回答
  • 2020-12-07 11:59

    Yes, you can add any repository as a submodule in your project. Just do:

    git submodule add git://github.com/whomsoever/whatever.git
    

    ... in the top level of your repository. This is indeed the easiest way with git to use some existing useful repository within your own. For more information on submodules, you could look at:

    • Pro Git's section on submodules
    • The quite readable bit in the git manual
    • The section on submodules in the git community book

    Update: as jfountain points out below, if you want to add the submodule at a subdirectory path (or with a name different from the default) you can supply that as an additional parameter to that command, e.g.:

    git submodule add git://github.com/whomsoever/whatever.git foo/bar
    
    0 讨论(0)
提交回复
热议问题