码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-10-07 16:01:23      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   使用   ar   for   

USING GIT IN XCODE

bubuko.com,布布扣

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”上提交。

bubuko.com,布布扣

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

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

bubuko.com,布布扣

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,在那里你可以发现你的分支。

bubuko.com,布布扣

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

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

bubuko.com,布布扣

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会询问你要与哪一个分支比较代码。

bubuko.com,布布扣

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

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

bubuko.com,布布扣

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来选择或者取消修改过的代码。

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

bubuko.com,布布扣

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上修改代码。

 

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

标签:style   blog   http   color   io   os   使用   ar   for   

原文地址:http://www.cnblogs.com/YouXianMing/p/4008980.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!