[Translation] Using git in xcode [5] Using git in xcode [5]

Source: Internet
Author: User
Tags using git

Using git in xcode

Using branches

Branches can be a very valid tive 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.

Branch control is a very useful way to isolate new features. Xcode supports branches well, but it is not displayed in the view. You can go to "Commit to branch ..." Select to submit to that branch, instead of submitting on "Commit X Files.

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

Xcode will ask you which branch you want to submit code to, or you can create another branch on your own.

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.

Once you submit code from the main branch to the sub branch, you will automatically switch to the sub branch. You can submit the modifications to this Subbranch. So how do you know which branch of xcode you are in? You can access repositories in organizer, where you can find your branch.

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

To view the current branch, view the view in the upper-right corner.

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.

To switch to the main branch or another branch, click "Switch branch" in the lower right corner ". Select another branch. Then, your xcode project workspace will automatically switch to the content in another branch.

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 wowould like to merge into your current branch.

When you are preparing to compare the code of two branches, switch to the branch you want to compare in organizer. Return to the project and select file | source control | merger from the xcode menu. xcode will ask which branch you want to compare code.

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

Xcode will display a comparative view, allowing you to check the differences between the two branches.

Use the scyclers 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.

Use scyclers to select or cancel the modified Code.

If there is a conflict, the tool that compares the code will highlight the conflicting code, and then display it in red with a question mark in the middle.

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.

The Code comparison tool provides four options to solve the conflict: Keep two changes, use the changes on the left, and use the changes on the right. In addition, you can directly modify the code on merge.

[Translation] Using git in xcode [5] Using git in xcode [5]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.