Xcode Git: Creating Apps in iOS 7 and OS X

xcode-gitGit is a popular software configuration management (SCM) system that offers many different lines of development, including frictionless context switching and disposable experimentation. Their branching model also allows unprecedented ease of app management, as they are independent of each other. Xcode can keep up with Git more than most people think, and they actually perform well together.

Here we are going to examine using these two in conjunction with each other, and what kind of performance you can expect to get from them. For a quick primer, check out our 1 Hour Xcode introductory course.

Git

If you are not familiar with Git, here is a basic overview: Git is a software configuration management system, an SCM, which is used to manage apps that have been developed or are in stages of development. What makes Git different from other SCM systems is its ability to use different branches that are separate from each other and can be independently created, deleted, or merged.

This means that, as a developer, you can switch between different ideas easily, create new pathways from existing ones, and switch between them all seamlessly. You can expand your ideas and be creative with what you do, and at the same time only put into production the ones that work and delete the ones that don’t. With the branch system of Git you can modify, exchange, produce, and merge incredibly simply. You can also learn some of the Git Basics here to get you started.

Xcode

Xcode is the app development system for Apple, the newest edition being Xcode 5. Xcode allows you to create apps for Apple, and can help you with layouts, configuration, and debugging. It will automatically configure your app for other Apple applications like iCloud, and if you put in your Apple ID it will upload your data, manage certificates, and more to help you and your team with your app development. The navigator can help you edit, and the auto layout will let you create your app interface with a free-form canvas. All of this can look pretty difficult, especially if you are new to programming. For a comprehensive beginner’s guide to using Xcode check out Xcode Fundamentals.

Starting Your New Project

To create a new project using Git all you need to do is check the option to create a local git repository when you create the project in Xcode. Xcode will then create the repository for your project through a Git service site and will allow you to create a remote copy. You will need to continue on to your organizer to add a remote to your project. You may need to provide authentication for the repository that you are using, but once done you will need to push your master branch. You can also use pre-existing projects, however you will need to go through your Git repository website to grab the ssh or https URL.

Creating and Editing

Now that you have gotten you project up and running, you can get started on creating and editing its elements. You should have a working copy of your project at this point, and you should also have a copy that you are editing. Xcode will show you which ones you are using and if they have been edited or not. You edit your project by committing changes you have made.

Xcode will allow you to choose which edits you want to commit and which ones you don’t. In this way you, as a developer, can play with different ideas and see which works best before you commit the changes. This way you don’t have to be stuck with changes that you see don’t work as well as you first thought.

There is a versions editor in Xcode that will allow you to see the git history for a file in three different ways: comparison, blame, and log. These three different views allow you to see your work with different edits on it, and from here you can pick and choose which edits or commits you want to keep or discard.

Seeing the history of your project can help you see which edits have been made and who made them. The blame tool is great to use when you are creating an app with a team of developers, so you can see which person made each edit.

Branches 

Branches are the different aspects, or layers, of your app. You will have a master branch, which is basically the ground floor, that is the basis of your entire app. From there you can create different branches that go in different directions, and can take your app to different levels. Using Git and Xcode you can create different edits and commit codes for different branches, meaning that these edits will only affect the branches that you want to edit, not your entire app. You can do this through Xcode by using the “commit to branch” tool. To move through your different branches you will need to use your organizer.

Now You Can Create Your Own Apps

All of this might seem pretty technical, and that’s okay. There are many different courses that you can take to help guide you through creating your apps using Xcode and Git. The Xcode platform is very thorough and will allow you to write code for a myriad of different apps and ideas. Git is a user-friendly software management system that makes it simple to edit and mange your project.

These two being used together actually works pretty well, and the Xcode supports the Git systems wonderfully. It is worth it for you to look into using them together for your next app design. Once you have used these tools to create an app, you should also try these ideas for Evaluating Your Software.

All of this may seem a little confusing, and that’s okay. There is a lot for you to work through as you begin to use this system. You can find more information on creating apps with a project-based approach in iOS App Development with Xcode for more clarification.