Stay on Top of Emerging Technology Trends
Get updates impacting your industry from our GigaOm Research Community
If you are planning on getting started in developing for the Mac, one of the first things I recommend setting up is a version control system. Beanstalk is a hosted Subversion system, so you can access your code from anywhere you have an Internet connection, team up with partners across the world, and keep a safe copy of your code off site, just in case. It’s tempting to rely on Time Machine for the ability to roll back changes, but Subversion has some key differences that make it a clear winner in ease of use and features.
For one, you can host a Subversion repository anywhere, either locally on your own Mac, or on the Internet, or on your local private network. Second, Subversion is built to work with multiple users, and can handle conflicting commits to the repository. Finally, Subversion can integrated directly into Xcode, which is what we are going to look at here.
To start, first head over to Beanstalk and create an account. Since I’m only ever working on one project at a time, the free hosting works fine for me, but there are also for-pay plans depending on your needs. Once you have the URL for your repository, it’s time to make some changes in Xcode. I’ll assume that you already have a project that you want to work with, and some code that you are ready to back up.
In Xcode, select “SCM”, and “Configure SCM Repositories.” Click on the + button towards the bottom left and add a name for the repository, and select “Subversion” as the SCM System. Add your custom URL. It will look something like this:
Where username is your Beanstalk user id, and projectname is the name of your first project. Enter in your password at the bottom, and the red error jewel at the bottom should go green and say “Authenticated.” Now that you have your repository set up, it’s time to add your project to it.
Adding Your Project
Open your project, and again go to the SCM menu. This time there should be a new menu option: “Configure SCM for this project,” select that. This will bring up the info window for your project. At the bottom of the “General” tab, change the SCM Repository selection from “None” to your newly created Beanstalk repository. Close the info window, and go to the SCM menu item again, you should see several more options there. Go down to the bottom and select “Commit Entire Project.” This will upload the project into Beanstalk and set up your project for source control. Once that is finished, it’s time to test it out.
Testing Things Out
Change one of the source code files in your project and save it. You should see a capital “M” (for Modified) in the far left column next to the “Groups and Files” area of Xcode. Right click on the file that you changed and select “Compare.” This will compare the change you just made with the most recently committed change in Beanstalk. If you are happy with the change, you can select “Commit Changes” from the SCM menu item. You should see the “M” disappear.
If you’ve made some changes that didn’t quite turn out the way you expected, it’s easy to roll back to a previous commit. Just select the file that you need to roll back, go to the SCM menu and select “Update to” and “Revision…”. This will let you select which version of the file you’d like to roll back to.
Using Subversion you can keep a detailed record of all the changes you make to a project as it progresses. Using a hosted service like Beanstalk ensures that you can recover from a hard drive failure or other catastrophe with very little effort. We have only just scratched the surface of Subversion, but by now you should be able to set up a repository, add your project to it, and commit and compare changes.