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 .)
You may want to synchronize the code to the server when modifying the code on the local backup. Xcode provides pulling-level pushing operations and tracking remote versions.
There are two methods for pull code from the server side. The first method is to operate directly in the window menu of the project. Select File | source control | pull from the xcode menu. If no modification is performed locally, xcode provides a menu for you to select the pull code from.
Alternatively, the pull button from the organizer repositories view can be used when a working copy is selected.
Another way is to click the pull button from 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) shocould be kept and in what order they shocould 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.
If a conflict is detected during the pull process, xcode will display the merge tool to help you solve the conflict. If you do not want to resolve the conflict, click the cancel button.
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.
If the conflict is resolved, you write the code again and want to submit the code.
You can submit code through 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.
Of course, you can also submit code to a new branch. xcode will check if there is any branch you want. If not, it will help you create that branch.
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 ).
Once a branch is created on the server, other versions can track that branch. To track a branch, access organizer, repositories, select remotes for the project repository, and then select the name of the expanded branch.
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.
After selecting that branch, click the track branch button, and you will update the code from the server to that branch. You can switch between different branches at will.
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 stored med 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.
Here, we can see that xcode supports git, including creating a git project, copying a git project, modifying operations, submitting code, and viewing history records, use version branches and slave servers for push or pull operations. Xcode does not directly support features such as hide, Tag, or more advanced and popular features. However, more advanced functions can be implemented through command line tools or third-party tools. In my day-to-day distributed team work, I frequently use the GIT tool that comes with xcode, and only a few cases will use the command line. If you have never used the GIT tool that comes with xcode, you can experiment with it and give feedback to the xcode team about the inconvenience, helping xcode improve the ease of use of git ^_^.
[Translation] Using git in xcode [6] Using git in xcode [6]