

With the project window selected you can access the File > Source Control > Merge menu option. There does not seem to be any way to perform the merge from the Xcode Organizer window. To do that you first need to switch back to the Master branch (using Xcode or from the command-line).Īt this point things get a little bit confusing with Xcode as to merge the changes you need to switch back to the Xcode project window. Once you have completed development of the new feature (and of course tested everything) it needs to get merged back into the master branch. $ git commit -a -m "Converted to ARC" Converted to ARCĤ files changed, 6 insertions (+ ), 15 deletions (- ) Merging Changes Back to Master The command-line equivalent would be something like this: If you really want to you can deselect some of the files from the commit, but all you really need to do is enter a commit message (always a good idea) and hit the commit button.

The commit window gives you a very nice overview of the files that will be included in this commit so that you can review the changes. To commit these changes to our new branch you can either use the Commit button in the Organizer or from the Xcode application menu use File > Source Control > Commit or if you can remember the keyboard shortcut simply type Option-Command-C. " to discard changes in working directory) # modified: Stepper.xcodeproj/project.pbxproj # modified: Stepper/UYLAppDelegate.m # modified: Stepper/UYLViewController.h # modified: Stepper/UYLViewController.m #no changes added to commit (use "git add" and/or "git commit -a")
GIT CREATE BRANCH FROM CURRENT LOCAL BRANCH UPDATE
" to update what will be committed) # (use "git checkout. # On branch ARC-Conversion # Changes not staged for commit: # (use "git add. Since at this point we only have the master branch we will use that and name the new branch “ARC-Conversion”:įor comparison to create this new branch from the command-line using the branch command: When you select the Add Branch button you get a dialog box allowing you to name the branch and also to specify from which branch this new branch should be based. You should then see the Add Branch and Remove Branch buttons in the command bar at the bottom: To create a new Git branch from the Xcode organizer you need to make sure that the Branches folder is selected in the left-hand Navigator pane. The Xcode features for managing branches are (mostly) contained in the Repositories section of the Xcode Organizer.

Creating a Branchįor the purposes of this post I am going to use my CodeExamples repository and create a new branch to experiment with converting one of the example projects to ARC. Since Xcode has the ability to manage Git branches I thought I would take a look and share my experiences in this post. The other version control operation that I suspect could sometimes benefit from some visual tools is the management of branches and in particular the merging of branches. Xcode does a pretty nice job of showing the two versions of a file side by side and highlighting the additions/deletions in a way that is a lot clearer than a command-line diff. The only version control operation that I do sometimes perform with Xcode is visualising differences between file versions. Xcode has supported Git for version control since version 4.0 but I generally prefer to perform my version control from the command-line.
