GIT-SVN with Xcode 4

The integration of GIT in Xcode 4 is really fantastic. However, if you are working in a SVN environment (where a GIT server is not available) and you want use GIT locally on your machine, using git-svn can solve your problems. But you need to use some small tricks to combine git-svn with Xcode 4.

I am currently using Xcode 4 vrs. 4.0.2 Build 4A2002a. Hopefully the following issue will be solved in Xcode 4.1. For the moment, you need to do some manual work to avoid problems.

So, you have your remote SVN repo. You need to clone your project to your machine. Launch the Terminal.app and navigate the directory where you want to have the local repo. For example, I have a local dir in my home folder named GITs. So, I do:

$ cd GITs

$ git svn clone path-to-your-svn-repo -s

The -s parameter assumes that your remote SVN repo is using the standard structure branches/, trunk/ and tags/ structure. Once the clone is complete, before launching Xcode, move inside the project directory. There, you find the .git/ directory. You need to add the following file (I am using here Textmate, but any text editor is fine):

$ mate .gitignore

and add the following lines

*.DS_Store

*.xcuser

*.xcuserstate

Save and now you can launch Xcode 4. Now, every time your user interface changes, you don’t need to commit the local changes.

3 notes

  1. geppyp posted this