简体   繁体   English

向现有的xcode项目中添加第二个Git存储库

[英]Adding a second Git repository to existing xcode project

I inherited a codebase from a coworker who left the company. 我从离开公司的同事那里继承了一个代码库。 He designed a custom library to use with the code which he put in our company's github account. 他设计了一个自定义库,以与他放入我们公司的github帐户中的代码一起使用。 However, I don't know how to pull this library into the project on MY computer from github. 但是,我不知道如何将该库从github放入我的计算机上的项目中。 I've managed to connect the project to the main code repository, but I don't know the step-by-step way to add the library. 我设法将项目连接到主代码存储库,但是我不知道分步添加库的方法。 I don't have tons of experience using command line git, but if that's the only way, I'm willing to try it... 我没有使用命令行git的大量经验,但是如果那是唯一的方法,我愿意尝试一下...

I have a project in XCode composed of 2 separate git repositories. 我在XCode中有一个由2个单独的git存储库组成的项目。 One is for the main host app and the other is for a separate number crunching library used by the host app. 一个用于主主机应用程序,另一个用于主机应用程序使用的单独的数字处理库。 The split was chosen as it would be nice to share the library as a more lightweight and independent body of code. 选择该拆分是因为最好将库共享为更轻量且独立的代码体。

Just pull the separate library repository into a separate (not nested) directory on disk and then link to this library from the main XCode project by adding the source to the project. 只需将单独的库存储库拉到磁盘上单独的(非嵌套)目录中,然后通过将源添加到项目即可从主XCode项目链接到该库。 XCode will automatically show you when changes are made to either repo in the file browser. 当在文件浏览器中对任一仓库进行更改时,XCode会自动向您显示。 The project file layout and repositories are independent concepts. 项目文件的布局和存储库是独立的概念。 You could have a separate repo for every source file if you wanted to. 如果需要,可以为每个源文件都有一个单独的存储库。

To pull the library on your local machine, first fork the repo to your own account and then pull it in using the instructions on the site . 要将库拉到本地计算机上,请先将存储库分叉到您自己的帐户,然后按照站点上的说明将其拉入。 .

https://help.github.com/articles/fork-a-repo https://help.github.com/articles/fork-a-repo

If you modify the library, remember to commit from the library directory. 如果您修改库,请记住从库目录提交。 When you push, you will update your fork. 按下时,您将更新叉子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM