[翻译] USING GIT IN XCODE [6] 在XCODE中使用GIT[6]

USING GIT IN XCODE

KEEPING IN SYNC WITH REMOTE REPOSITORIES

As you make changes in your local working copy you will want to keep them in sync with the remote repository.  Xcode offers support for pulling from and pushing to a remote repository, and for tracking remote branches.

There are two ways to pull from a remote repository. The first is from the project window.  Select File | Source Control | Pull from the Xcode menu when viewing a project window.   If there are no uncommitted changes in the working copy, Xcode will present a dialog to select which remote and branch to pull from. (Note that a pull can be completed using command line Git when changes are present, but Xcode will not pull with uncommitted changes in the working directory.)

也许你想在本地备份上修改代码的时候,同步到服务器端当中。Xcode提供了pulling一级pushing操作,以及追踪远程版本。

有两种方式来从服务器端pull代码。第一种方式就是直接在工程的window菜单中操作。选择File | Source Control | Pull from the Xcode menu,如果本地没有进行修改的操作,Xcode将会提供一个菜单供你选择从哪一个分支上pull代码。

Alternatively, the Pull button from the Organizer Repositories view can be used when a working copy is selected.

另外一种方法是,这个Pull的按钮可以从Organizer Repositories中点选。

If a conflict is detected on the pull, Xcode will present the merge viewer to resolve the conflict.  Just like resolving a conflict between branches, the merge viewer can be used to select which change(s) should be kept and in what order they should be if both are desired. If you do not want to resolve the conflict, click the Cancel button in the merge view and the pull will not take place.

如果在pull过程中检测到了冲突,Xcode会显示出merge工具来帮你解决冲突。如果不想解决冲突,点击取消按钮也行。

If the conflict is resolved, the working copy will be modified and will need to be committed and pushed.

To push changes to the remote repository, select File | Source Control | Push from the Xcode menu when viewing a project window.

如果冲突被解决了,你又写了代码并想提交代码。

你可以通过File | Source Control | Push from the Xcode menu来提交代码。

A branch can also be pushed to the remote repository.  Xcode will detect if the branch does not yet exist in the remote, and will indicate if the branch will be created by a push.

当然你也可以提交代码到一个新的分支中去,Xcode会检测有没有你想要的那个分支,如果没有,他会帮你创建那个分支。

Once a branch has been created on the remote repository, other working copies can track that branch.   To track a branch, visit Organizer, Repositories, and select Remotes for the project repository.  Expand the remote name to see the available branches.  (In my testing, I was not able to get Xcode to refresh remote branches without restarting Xcode).

一旦一个分支在服务器上被创建了,其他的版本都能够跟踪那个分支。要跟踪一个分支,访问Organizer,Repositories,选择Remotes for the project repository,然后选择展开的那个分支的名字。

Select a remote branch and click the Track Branch button at the bottom of the view.  This will pull down the branch from the remote repository to the local repository, will allow you to switch to the branch in Xcode, and will allow pulls and pushes to take place from it.

选择了那个分支后点击Track Branch按钮,你就会从服务器更新到那个分支的代码,你可以随意的在不同的分支中切换来切换去。

SUMMARY

As we have seen here, Xcode has very usable support for common Git tasks, including setting up Git for a new project, cloning an existing project, handling modifications and commits, viewing history, using branches, and pushing and pulling from remote repositories.  Xcode does not have direct support for stashing, tags, or more advanced topics like rebasing or submodules.  However, all of the items that Xcode does not support can be performed using the command line tools or using a third party tool.  In my day to day work with a distributed development team, I am frequently able to perform all of my Git tasks in Xcode, and only rarely need to resort to the command line.  Take a second look at Xcode’s Git support if you have not done so before, and give feedback to the Xcode team so they can keep enhancing and improving Git support in Xcode.

在这里,我们可以看出,Xcode支持Git很到位,包括创建一个Git项目、拷贝一个Git项目,操作修改,提交代码,浏览历史记录,使用版本分支以及从服务器进行push或者pull操作。Xcode并没有直接支持诸如隐藏、标记、或者一些更高级更热门的功能。然而,那些更高级的功能都能够通过命令行工具或者是第三方工具来实现。在我日复一日的分布式团队工作当中,我频繁的使用者Xcode自带的git工具,只有极少数情况会用到命令行。如果您没用过Xcode自带的git工具,你可以试验一把,并给Xcode团队反馈使用上不方便的地方,帮助Xcode提升Git的使用便利性^_^。

时间: 2024-08-17 06:14:09

[翻译] USING GIT IN XCODE [6] 在XCODE中使用GIT[6]的相关文章

Git权威指南学习笔记(二)Git暂存区

如下图所示: 左侧为工作区,是我们的工作目录. 右侧为版本库,其中: index标记的是暂存区(stage),所处目录为.git/index,记录了文件的状态和变更信息. master标记的是master分支所代表的目录树.HEAD指向master分支. objects标记的是Git的对象库,所处目录为.git/objects,文件索引建立了文件和对象库中对象实体之间的映射关系. 通过该图我们可以清晰地看出add,commit等命令的转化关系.下面通过git diff和git status两条命

不懂Git,别说自己是程序猿–20分钟git快速上手(转)

在Git如日中天的今天,不懂git都不好意思跟人说自己是程序猿.你是不是早就跃跃欲试了,只是苦于没有借口(契机). 好吧,机会就在今天. 给我20分钟,是的,只要20分钟, 让你快速用上git. 我们废话不多说,直接来干货. 我们将会介绍一下几点: 一, 什么是git 二,使用git的一般开发流程 三,快速安装新建项目.holloword. 开始: 一.什么是git. 阅读本文的前提是你知道或者用过至少一种源代码管理工具,比如:SVN, CVS 或者TFS等等. 你必须知道什么是源代码管理.如果

[翻译] USING GIT IN XCODE [5] 在XCODE中使用GIT[5]

USING GIT IN XCODE USING BRANCHES Branches can be a very effective tool to isolate new features or experiments in code.  Xcode has pretty good support for branches, but it is not shown in the project view.  The first method you can use to commit code

转-----在Xcode中使用Git进行源码版本控制

在Xcode中使用Git进行源码版本控制 http://www.cocoachina.com/ios/20140524/8536.html 本文翻译自Understanding Git Source Control in Xcode (译者myShire)欢迎您加入我们的翻译小组. 在应用程序开发过程中,很重要的一部分工作就是如何进行源码的版本控制.当代码出现问题时,我们就需要将代码恢复到原先正常的版本.如果是多个人共同开发一个项目,那么代码的控制就会非常复杂.幸运的是,开发者不需要自己控制这些

在Xcode中使用Git进行源码版本控制[转载]

本文翻译自Understanding Git Source Control in Xcode (译者myShire)欢迎您加入我们的翻译小组. 在应用程序开发过程中,很重要的一部分工作就是如何进行源码的版本控制.当代码出现问题时,我们就需要将代码恢复到原先正常的版本.如果是多个人共 同开发一个项目,那么代码的控制就会非常复杂.幸运的是,开发者不需要自己控制这些,因为有专门的软件来负责,叫做版本控制系统. 版本控制系统,或者说修改控制系统,实际上是一种检测源文件的改变并将其保存留作以后参考使用的机

在Xcode中使用Git进行源码版本控制

在应用程序开发过程中,很重要的一部分工作就是如何进行源码的版本控制.当代码出现问题时,我们就需要将代码恢复到原先正常的版本.如果是多个人共同开发一个项目,那么代码的控制就会非常复杂.幸运的是,开发者不需要自己控制这些,因为有专门的软件来负责,叫做版本控制系统. 版本控制系统,或者说修改控制系统,实际上是一种检测源文件的改变并将其保存留作以后参考使用的机制(软件).此外,它还能记录其他有用信息,比如是哪个开发者修改了代码,何时修改的,修改了哪一部分,以及其他历史信息.版本控制系统可以比较不同版本代

如何在mac里面,把xcode代码同步到 tfs 的 git库

在mac安装visual studio code https://code.visualstudio.com/Download 在mac新建一个文件夹 用vs code打开这个文件夹 按照下图,把git控制台调出来 切换到"终端" 输入 git clone http://tfs2017.***.com/tfs/rd/aa.mobile/_git/abc 重新打开vs code,打开克隆下来的abc文件夹 可以看到git面板已经正确指向abc文件夹

同时兼容 Xcode 7 和 Xcode 8

做为 iOS 开发者,你肯定会对 iOS 10 中的新特性感到无比兴奋,并迫不及待地想要在应用中进行实践.虽然你想马上就动手以便第一时间就能"上船".但 iOS 10 正式上线却是几个月以后的事情,而且在那之前,你还需要保持每几周就发布一次的频率.这个情况听起来是不是跟你现在的处境很像呢? 当然,目前你还不能用 Xcode 8 来编译需要发布的应用--因为它无法通过 App Store 的验证.所以你需要把项目拆分成两个分支,稳定分支和 iOS 10 开发分支-- 而不可避免地是,这烂

Xcode 5、Xcode 6 免证书真机调试

我们都知道,在iOS开发中,如果要进行真机调试的话是需要苹果开发者账号的,否则Xcode就不能够进行真机调试,只能够在模拟器上运行:这就带来了很多问题,比如iCloud编程的话你不能够用模拟器.要用到拍照功能的话你不能够用模拟器.要用到陀螺仪功能的话你也不能够用模拟器等,也就是说跟硬件密切相关的话就不能够用模拟器了,只能够用真机来进行开发.可是.....,苹果开发者账号要一年99美刀,也就是600元人民币.对于一个像我这样的穷人来说,那是多么大的数字,当然,你也可以资助一下我.如果你不想支付这笔

[Xcode 7.2]Xcode菜单栏之你不知道的那点事

郝萌主倾心贡献,尊重作者的劳动成果,请勿转载. 如果文章对您有所帮助,欢迎给作者捐赠,支持郝萌主,捐赠数额随意,重在心意^_^ 我要捐赠: 点击捐赠 Cocos2d-X源码下载:点我传送 游戏官方下载:http://dwz.cn/RwTjl 游戏视频预览:http://dwz.cn/RzHHd 游戏开发博客:http://dwz.cn/RzJzI 游戏源码传送:http://dwz.cn/Nret1 本文调研Xcode的版本是 7.2,基本是探索了菜单的每一个按钮.虽然从xcode4一直用到了x