Git Submodule to a subfolder

后端 未结 3 496
青春惊慌失措
青春惊慌失措 2020-12-09 02:36

In svn you can link a repository to any folder in another svn repository. I\'m wondering if there is a similar feature for git? Basically I want a git submodule inside my

3条回答
  •  情歌与酒
    2020-12-09 03:11

    I'm running into the same issue. It doesn't look solvable from a git level, at least not in a way that lets you easily pull or push to the parent repo.

    However, you can work around this limitation by using a simple symlink:

    1. Set up your submodule in a separate directory.
      • git submodule add http://example.com/repo.git ./submodules/repo
    2. Create a symlink to the subfolder in the place you want:
      • ln -s ./submodules/repo/subdirectory ./wherever/symlinked_directory

    References:

    • http://git-scm.com/book/en/Git-Tools-Submodules
    • http://www.cyberciti.biz/faq/unix-creating-symbolic-link-ln-command/

提交回复
热议问题