How to add version control to an existing project in Xcode

Setting up a local GIT repository:

Open Terminal and change to the directory where your project is located (cd /path/to/your/project). Then use the following shell commands:

git init
git add .
git commit -m "my initial commit (or any other comment you feel like)"

NOTE: as of Mountain Lion you need to install the Xcode Command Line Tools for this to work (under Xcode Preferences – Downlaods – Components).

Setting up a local SUBVERSION repository:

Subversion cannot place an existing directory under version control. Instead you need to create a new directory which serves as the subversion repository. You then checkout a working copy from this repository, work with it and then commit your changes back to the repository.

  • Open Terminal and and create a new directory to hold your repository (i.e. mkdir repos)
  • inside this directory create three sub-directories called trunk, tags and branches (i.e. repos/trunk, repos/branches, repos/tags)
  • copy your existing Xcode project into the trunk folder
  • enter ‘svnadmin create’ inside your main repository directory (i.e. in repos)
  • enter ‘svn import’

NOTE: Subversion has one extreme drawback: it sucks. Again for any of this to work in Mountain Lion you need to install the Xcode Command Line Tools (under Xcode Preferences – Downlaods – Components).





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.