简体   繁体   English

将项目集成到一个项目中

[英]Integrate Projects in a single project

I have same xcode project on two deferent macbooks with different code.we need to merge that code but we are not using any git account.We need to merge same file as well,I mean we have same viewcontroller and added two people add a code in single view controller How i can merge it. 我在两个不同代码的不同macBook上有相同的xcode项目。我们需要合并该代码,但我们没有使用任何git帐户。我们也需要合并相同的文件,我的意思是我们有相同的viewcontroller并添加了两个人添加代码在单视图控制器中我如何合并它。 For example: 例如:

I have a view controller Name "XYZ"and Person 1 added "Login Method" into "XYZ" and person 2 added "Sign up Method" into XYZ. 我有一个视图控制器名称“XYZ”,人员1在“XYZ”中添加了“登录方法”,人员2在XYZ中添加了“注册方法”。 and both code are on deferent macbook without any git account how I can merge that. 并且两个代码都在不同的macbook上,没有任何git帐户我如何merge它。

Since you use the git tag, I will provide the way to do version control by git. 由于你使用git标签,我将提供通过git进行版本控制的方法。 First, please sign up account for bitbucket (free for private repository) or github (only free for public repository). 首先,请注册bitbucket帐户(私人存储库免费)或github (仅限公共存储库免费)。 And create a repository. 并创建一个存储库。 They are as the remote git repository(repo). 它们是远程git存储库(repo)。

Then use git bash for local repository. 然后使用git bash作为本地存储库。

In one macbook, use these steps: 在一个macbook中,使用以下步骤:

  1. git clone <URL for your bitbucket or github repo>
  2. cd reponame
  3. copy your xcode project in reponame folder 将您的xcode项目复制到reponame文件夹中
  4. git add .
  5. git commit -am 'code version from first macbook'
  6. git push

Now the code in the first macbook is pushed in your remote repo. 现在,第一个macbook中的代码被推送到远程仓库中。

In the other macbook, use these steps: 在另一个macbook中,使用以下步骤:

  1. In an empty folder, use git init 在空文件夹中,使用git init
  2. copy your xcode project in this folder 将您的xcode项目复制到此文件夹中
  3. git add .
  4. git commit -am 'code version from second macbook'
  5. git remote add origin <URL for your bitbucket or github repo>
  6. git pull origin master
  7. Now the code from macbook1 is merging in macbook2 现在macbook1的代码正在macbook2中合并
  8. If there has conflict files, you should check and save them, and then use git add . 如果存在冲突文件,则应检查并保存它们,然后使用git add . and git commit -m 'solve merge conflict' . git commit -m 'solve merge conflict'
  9. Now this is the version that you merge the different macbooks together. 现在,这是将不同的macbooks合并在一起的版本。 You can push the version in remote repo by git push . 你可以通过git push远程仓库中的版本。

More git related, you can refer git book . 更多git相关,你可以参考git book

Any version control system comes to handy in this kind of situations. 在这种情况下,任何版本控制系统都会派上用场。 Merging manually is the option available other than version control system. 手动合并是版本控制系统以外的其他选项。 Either merge using version control system like git or manually merge the files which is very hard to workout. 使用像git这样的版本控制系统进行合并,或者手动合并非常难以锻炼的文件。

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

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