2011-09-07 120 views
8

我工作的一个小图书馆,它依赖于另一个项目GitHub的。添加符号链接的Git仓库

我知道 some projects 添加符号链接。你究竟如何做到这一点?

+1

[http://stackoverflow.com/questions/954560/what-does-git-do-to-files-that-are-a-symbolic-link](http:// stackoverflow.com/questions/954560/what-does-git-do-to-files-that-are-a-symbolic-link) –

+0

感谢您的链接,但并没有真正解释如何做到这一点,刚刚发生了什么如果你有它。例如,我是否将依赖项目签出到我的项目的子目录中,并使其起作用? –

+0

对不起,我读得太快,错过了关于取决于另一个github项目的部分。我没有答案。 –

回答

13

什么你要使用的都是git submodules

实施例:git submodule add git://github.com/user/project.git destination-dir/

+1

这是一个很好的指南,涵盖了基本的子模块用法:http://codingsnippets.com/getting-started-with-git/ – SuitedSloth

+0

但是请注意,如果其他代码具有自己的git repo,则此工作正常。否则,符号链接解决方案效果很好,就像这样[两个Rails应用程序之间的共享模型 - 什么是Workflow的理想解决方案?](http://stackoverflow.com/questions/7024741/shared-models-between-two-rails-应用 - 什么 - 是最完美的解决方案,为工作流) –