Every developer needs to be using a source control system. When I used to work for a big software company working on Windows based development systems we used Perforce. Starting to work on my own with OS X Tiger, I initially used Perforce there too. Perforce is a client/server system, but I was running both on the same computer. Installation is far from straightforward. There’s no Mac installer – you are directed to a server install for Darwin – the open source Unix underlying OS X. And you need to know your way around a Unix system to install it. When I moved to a new Mac with Leopard and tried to install Perforce on that, I didn’t suceed at all. I’m sure it can be made to work, but it was beyond my Unix skills and one really shouldn’t have to work so hard just to install software. It doesn’t bode well for the future.

Meanwhile there’s been a lot of buzz around a new SCM system from Linus Torvalds called Git. So I thought I’d give that a try instead.

Apple MacBook MB402LL/A A1181 13.3' C2D 2.1GHz 2GB RAM 120GB SSD OS X 10.6 $149.75 Apple Macbook A1181 White Laptop Notebook 2.1GHz 4GB RAM 80GB HDD Mac OS X 10.6. Also, OS X Mountain Lion takes up about 10 GB of space on its initial installation, so the computer where you install Mac OS X must have at least 10 GB of space in its hard drive. However, that's only the bare minimum; if you plan to install Mac OS X for day-to-day use, I recommend allocating at least 50 GB of space.

If you have Leopard the installation is really easy. Get the OSX Git Installer from Google Code, and it’ll do all the work for you with a standard OS X GUI installer.

Netboot

To start working with it it pretty simple too. Rather than keeping one source code repository for everything you do as Perforce does, Git keeps a seperate repository for each project. Open a terminal window and change to your project directory. The one with your project file in. Then type

git init

That will create a new and empty repository in a subdirectory called “.git”. The leading dot means that the directory will be invisible ordinarily.

Next thing is to tell Git about files that you don’t want to store in the repository. For example you don’t want to save all your build files. You can store this information separately for every project you create, but that would be repetitive, so I suggest you set this globally. Create a file in you user directory called .gitignore. I suggest this as the contents:

.DS_Store
*.swp
*~.nib
build
*.pbxuser
*.perspective
*.perspectivev3

Laptop

Next you’ll have to make git know about that file. Type

git config core.excludesfile ~/.gitignore

Now, in your project directory, type

git add .
git status

Git add tells git what files you want to track. In this case all in the current directory and subdirectories (ignoring those mentioned in .gitignore). git status confirms that you’ve done.
Then actually store all your files in the repository for the first time with

git commit -m 'Initial commit of project'

Os X Laptop Compatibility

OK that was a very quick summary of installation and getting started up to the first commit. Git does take some earnign though before you can use it properly. I recommend reading: Pragmatic Version Control using Git – The pdf version is available for $22.
Also, if like me you need to really know what’s going on under the hood in order to be confident wielding it, this free pdf is great for that: Git From The Bottom Up