[翻译] 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-09-18 19:25:01

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

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

USING GIT IN XCODE http://www.cimgf.com/2013/12/10/using-git-in-xcode/ Git has become a very popular version control system in iOS and Mac development. Git comes with a set of command line tools to check status, commit changes, view logs, make and me

[翻译] 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

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

USING GIT IN XCODE MAKING AND COMMITTING CHANGES Once you have a working copy of your project, it's time to get to work.  As you make changes to the project, Xcode will indicate when files have been changed from the working copy. 当你成功的将项目复制到了本地,现在就可以

xcode 左边导航栏中符合含义详解_IOS

xcode 左边导航栏中符合含义详解 "M" = Locally modified    "U" = Updated in repository  "A" = Locally added    "D" = Locally deleted    "I" = Ignored  "R" = Replaced in the repository  "–" "=&qu

sdk-xcode中使用git提交时报错The working copy"H5Service.bundle"

问题描述 xcode中使用git提交时报错The working copy"H5Service.bundle" The working copy"H5Service.bundle" failed to commit files.我用到了芝麻信用的SDK,需要导入H5Service.bundle,使用没问题,但是git提交时报了这么个错误,有知道怎么解决的吗? 解决方案 这个文件没意见加到版本控制吧 git add添加

Git详解之四:服务器上的Git

原文链接:http://blog.jobbole.com/25944/ 原文:<Pro Git> 服务器上的 Git 到目前为止,你应该已经学会了使用 Git 来完成日常工作.然而,如果想与他人合作,还需要一个远程的 Git 仓库.尽管技术上可以从个人的仓库里推送和拉取修改内容,但我们不鼓励这样做,因为一不留心就很容易弄混其他人的进度.另外,你也一定希望合作者们即使在 自己不开机的时候也能从仓库获取数据 - 拥有一个更稳定的公共仓库十分有用.因此,更好的合作方式是建立一个大家都可以访问的共享仓

git教程(二)--安装和配置git

转载:http://blog.csdn.net/gatieme/article/details/50586476 前言 GIT跟SVN一样有自己的集中式版本库或服务器.但,GIT更倾向于被使用于分布式模式,也就是每个开发人员从中心版本库/服务器上chect out代码后会在自己的机器上克隆一个自己的版本库.可以这样说,如果你被困在一个不能连接网络的地方时,就像在飞机上,地下室,电梯里等,你仍然能够提交文件,查看历史版本记录,创建项目分支等.对一些人来说,这好像没多大用处,但当你突然遇到没有网络的

[网摘收藏]Ubuntu中版本控制Git的使用

Git 使用规范 特别提醒: 使用Git过程中,必须通过创建分支进行开发,坚决禁止在主干分支上直接开发.review的同事有责任检查其他同事是否遵循分支规范. 在Git中,默认是不会提交空目录的,如果想提交某个空目录到版本库中,需要在该目录下新建一个 .gitignore 的空白文件,就可以提交了 [代码回溯注意]把外部文件纳入到自己的 Git 分支来的时候一定要记得是先比对,确认所有修改都是自己修改的,然后再纳入.不然,容易出现代码回溯 [代码回溯注意]多人协作时,不要各自在自己的 Git 分

《走进git时代系列三》详解部分git思想及SVN/GIT命令对比解析

之前写了一篇 走进git时代一之你该怎么玩? , 主要是对git的特性做了个引导, 用户还是需要自己找资料系统的去学习. 所以补充一篇分享,稍微详细一点解释一下svn和git的差异性, 以及日常工作的命令对比 . 帮助大家在学习git的道路上更加清晰. 目录 再谈SVN/GIT思想差别带来的影响 你需要知道的SVN/GIT命令操作 首先还是要强调一下 : 在开始学习 Git 的时候,请不要尝试把各种概念和其他版本控制系统(SVN,P4等)相比拟,否则容易混淆每个操作的实际意义. Git 在保存和

UWP开发入门(十九)——10分钟学会在VS2015中使用Git

原文:UWP开发入门(十九)--10分钟学会在VS2015中使用Git 写程序必然需要版本控制,哪怕是个人项目也是必须的.我们在开发UWP APP的时候,VS2015默认提供了对微软TFS和Git的支持.考虑到现在Git很火,作为微软系的程序员也不得不学一点防身,以免被开源世界的家伙们嘲笑.蜀黍我Git也是菜鸟一只(还请老司机多多指点),只会用VS2015和SourceTree这样的GUI工具点一点按钮,但是我相信用惯了SVN和TFS的童鞋们,需要一点勇气去学习一些新东西,特别是Git已经形成潮