如何合并xcode中同一项目的两个版本? [英] How to merge two versions of the same project in xcode?

查看:189
本文介绍了如何合并xcode中同一项目的两个版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的同事和我一起在Xcode的iPhone应用程序上工作。时不时,我们想合并我们的工作。理想情况下,这应该也适用于我们离线时使用USB记忆棒交换彼此的项目。



对于这种情况,大多数变化是无冲突的,哪种方式我可以用它来在本地合并这两个整个项目,并保持本地GIT存储库与这些合并同步? 要合并对您的版本进行更改后,您需要将您的同事的版本作为远程存储库(尽管存储在本地硬盘上)添加到您的项目中,然后将您同事项目中的更改引入您自己的项目。



详细信息:
我假设您在本地硬盘上拥有相同Xcode项目的两个副本,其中包含不同的更改,您和具有其他更改的副本从你的同事那里,你想合并到你自己的版本。



此外,我假设你们都使用本地GIT存储库进行本地版本控制。当你启动一个新的Xcode项目时,这是默认的,所以你不必担心这个。



假设项目文件夹位于以下位置: p>

  / Users / UserName / projects / YourVersion 
/ Users / UserName / projects / YourColleaguesVersion

要将您的同事项目作为远程存储库添加到项目中,请执行以下操作:

<请点击组织者窗口顶部的存储库 $ b $>

  • 点击组织者窗口顶部的存储库
  • $ b
  • 在管理器窗口左侧的列表中找到YourVersion

  • 单击YourVersion下的远程
  • 在出现的对话框中,键入以下内容:

    • 远程名称: YourColleaguesVersion

    • 位置: file:/// Users / UserName / projects / YourColleaguesVers离开


  • 点击创建按钮并关闭管理器窗口


    现在,将您的colleage项目中的更改拖入项目中,执行以下操作:


    • 在Xcode的菜单中单击:文件>源代码管理>拉... ...

    • 打开一个对话框并显示选择要从中更改的远程位置。 - 它应该显示 YourColleaguesVersion / master 作为远程存储库,它应该显示远程在线。点击选择按钮。

    • 完成了。


    My colleague and I work together on an iPhone app in Xcode. Now and then, we want to merge our work. Ideally, this should also work when we are offline and use a USB stick to exchange eachother's projects.

    For the case the majority of the changes are non-conflicting, what way can I use to merge these two whole projects locally, and keeping the local GIT repository in sync with these merges?

    解决方案

    To merge the changes into your version, you need to add your colleague's version as a remote repository (although stored locally on harddisk) to your project and then pull the changes from your colleague's project into your own project.

    Details: I'm assuming you have two copies of the same Xcode project, with different changes, on your local harddisk, yours and the one with the additional changes from your colleague that you want to merge into your own version.

    Moreover, I'm assuming that both of you use a local GIT repository for local version control. That's the default when you start a new Xcode project, so unsually you don't need to worry about this.

    Let's assume the project folders are in these locations:

    /Users/UserName/projects/YourVersion
    /Users/UserName/projects/YourColleaguesVersion
    

    For adding your colleagues project as a remote repository to your project, do this:

    • Go to the Organizer (click in Xcode's Menu: Window > Organizer)
    • Click on Repositories at the top of the Organizer window
    • Locate YourVersion in the list at the left side of the Organizer window
    • Click on "Remotes" under YourVersion
    • Click on "Add Remote" at the bottom of the Organizer window
    • In the Dialog which appeared, type in this:
      • Remote Name: YourColleaguesVersion
      • Location: file:///Users/UserName/projects/YourColleaguesVersion
    • Click the "Create" button and close the Organizer window

    Now for pulling the changes from your colleage's project into your project, do this:

    • Click in Xcode's Menu: File > Source Control > Pull...
    • A Dialog opens and says "Choose remote from which to pull changes." - It should show YourColleaguesVersion/master as the remote repository and it should say Remote is online. Click on the "Choose" button.
    • You're done.

    这篇关于如何合并xcode中同一项目的两个版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆