The Subversion and Xcode combination has been way too flaky for my tastes. I've tried to keep the repositories on a central machine in the house without success. When the
hackintosh was my
main dev machine, I used it as the central location for the Subversion repositories. When I'd got to synch from the
hackintoshed MSI Wind, it would sometimes work, and more often than not I'd get "network connection shut down unexpectedly". When the Mac Mini went in as the home entertainment computer, I tried moving things to that machine. Results were better, but still not reliable. I would still have to try several times, or quit Xcode and restart. Sometimes I would just have to give up, let check-ins pile up, and try again later.
This clearly wasn't going to fly, despite having put up with it for six months. If I was going to move to something else, it might as well be one of those cool distributed source control systems all the kids are using these days. I looked at Mercurial, git, and gave a passing glance to Bazaar. I thought I could get Mercurial onto the
MyBook World, but that didn't go as smoothly as planned. In the end, I settled on git, and for no particular reason other than
github offers a nice setup for cheap. I can get to it from anywhere, so if I forget to synch the changes made on the iMac to the Macbook before getting on the bus, I can do it
on the bus if it has WiFi (which the Sound Transit 545 usually does). Write code on a plane, and commit as soon as I get a connection. I do a lot of my iPhone/OS X coding offline, and I like frequent commits, so being able to commit from anywhere I had an Internet connection was a big plus. Other than that, the other two options would probably work well for my purposes as a one-man shop.
But is there a way to keep that same sweet (albeit flakey) Xcode integration that one gets with Subversion? Apparently there is not. There is a GUI in the form of
Gitx, but it apparently doesn't do remote commits (that's just what I read, I haven't even tried yet.) No matter, it's not like working from the command line is that hard with git.
git commit, then
git push, and we're done. Zack Rusin has
a really good cheat sheet that I've found to be quite handy.
However, following the usual instructions on setting up the repository left a bit of a mess at first. Sure, it's easy to
cd to the root of the Xcode project and do a
git add .. You'll be in for a surprise when you check the repository after doing a push, though. Everything in the build output directory gets pushed, as well as some other artifacts that you probably don't want in the repository.
Want you want to do
before executing those easy
git commit/push commands is to create a
.gitignore file in the root of the project directory. Shane Vitarana has
exactly what you need to cut and paste into
.gitignore, as well as what needs to go in
.gitattributes so that git treats the Xcode project file as a binary and prevents git from trying to fix things that don't need fixing.
With that done, it's a simple matter of keeping the cheat sheet handy, a terminal window open, and typing a few short commands once in a while instead of right-click/Commit in Xcode.