[翻译] 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 to a branch is to select “Commit to Branch…” instead of “Commit X Files” from the commit view.

分支控制是一个非常有用的隔离新特性的一种开发方式。Xcode对于分支支持得很好,但是没在视图中显示出来。你可以在 “Commit to Branch…”中选择向那个分支提交,而不是在“Commit X Files”上提交。

Xcode will ask you to select a branch to commit to, or will allow you to create a new branch.

Xcode会问你要向哪一个分支上提交代码,抑或你自己再创建一个分支出来。

Once you have committed to a branch from master, you will be automatically switched to that branch.  You can continue making changes and commits to the branch.  So how do you know what branch you are on in Xcode, or get back to the master branch, or switch to another branch?  Visit the Repositories in the Organizer, find the repository for your project, and select the working copy.

一旦你从主分支向子分支提交了代码,你将会自动切换到子分支当中去。你可以继续进行修改提交到这个子分支中。所以,你怎么知道你是在Xcode中的哪一个分支呢?你可以通过访问Organizer中的Repositories,在那里你可以发现你的分支。

To see what branch you are currently on, look in the upper right hand corner of the Repository view.

为了查看当前是在哪一个分支上,查看右上角的view。

To switch back to master or to another branch, click the “Switch Branch” button in the lower right hand corner.  Select another branch, and your Xcode project workspace will be updated to reflect the current contents of the other branch.

为了切换到主分支或者是其他分支中去,点击右下角的按钮“Switch Branch”。选择另外一个分支,然后,你的Xcode project workspace会自动的切换到另外一个分支中的内容。

When you are ready to merge a branch, switch to the branch you want to merge into first from the Organizer.  Then switch back to the project view,  and select File | Source Control | Merger from the Xcode menu.  Xcode will ask which branch you would like to merge into your current branch.

当你准备比较两个分支的代码时,先在Organizer中切换到你要比对的分支当中去。然后回到工程中,选择File | Source Control | Merger from the Xcode menu,Xcode会询问你要与哪一个分支比较代码。

Xcode will then present a merge view, which will allow you to review each difference between the current branch and merge branch.

Xcode之后会显示出一个比较的view,允许你检查两个分支的不同之处。

Use the sliders to selectively include or exclude changes from the branch in the merge.

If there is a conflict in the merge, the merge view will highlight the conflict in the merge view with red and a question mark in the center.

使用sliders来选择或者取消修改过的代码。

如果存在着冲突,比较代码的工具会高亮冲突的代码,然后在中间的地方用红色的带有疑问的标记显示着。

The merge view will offer four choices for resolving the conflict: keep both changes, placing the left before right, keep only the left changes, keep only the right changes, and keep both changes, placing the right before left.  In addition the code can be directly edited in the merge view.

比较代码的工具会提供4种选择解决冲突:保持两个改变,使用左边的变化,使用右边的变化,另外,你可以直接在merge上修改代码。

目录
相关文章
|
Java jenkins 持续交付
Xcode + cocoapods + jenkins + fastlane + git + 蒲公英自动化打包 上传
Xcode + cocoapods + jenkins + fastlane + git + 蒲公英自动化打包 上传 构建自动化步骤为: 1. Xcode 有Xcode 内部提供的打包命令来打包完成代码的编译和证书签名到最后打包。
2862 0
|
开发工具 iOS开发 git
mac安装git后,在终端里运行git命令,系统提示需要安装Xcode问题解决
直接下载git for mac 安装包,https://git-scm.com/download/mac 安装完后,git的默认安装目录是:/usr/local/git 但是使用 which git 命令后,发现git的目录是:/usr/bin/git 意思是我们安装的git-xxx.dmg默认路径在/usr/local/git,但Mac系统执行git命令却去/usr/bin/git下找。
3215 0
|
开发工具 git iOS开发
Mac 下为 XCode 创建 Git 服务器 - 简单得不能再简单
Mac 下为 XCode 创建 Git 服务器 - 简单得不能再简单 太阳火神的美丽人生 (http://blog.csdn.net/opengl_es) 本文遵循“署名-非商业用途-保持一致”创作公用协议 转载请保留此句:太阳火神的美丽人生 -  本博客专注于 敏捷开发及移动和物联设备研究:iOS、Android、Html5、Arduino、pcDuino,否则,出自本博客的文章拒绝转载或再转载,谢谢合作。
1097 0
|
开发工具 iOS开发 git
Using GIT In Xcode
Using GIT In Xcode Post by Joe Keeley on December 10, 2013 Git has become a very popular version control system in iOS and Mac development.
1275 0
|
开发工具 iOS开发 git
iOS开发那些事-Git在Xcode中的配置与使用
<p>很多Git命令都是在命令行下运行的,命令行下管理Git有很多优点不用多说。但最大的缺点是要求用户记住这些命令。因此Git图形界面还是很受一些用户欢迎的,其中Xcode作为集成开发环境工具,也提供了一定Git图形界面功能。但是要想在Xcode中使用Git管理工程代码还想需要进行一些配置,然后才能使用。</p> <p>如果我们是使用Xcode 4创建的一个iOS工程,在终端的命令行中提交代码
1600 0

热门文章

最新文章

相关实验场景

更多