
When I first started making apps I didn’t care about version control software. I did have my own backup method that consisted of me copying my current code to another directory then add a version number to the end with a short description. This would ensure that I could go back to a previous version of working code if I messed up the current feature I was working on. When my apps started getting bigger and more complex I started to understand the value of true version control software.
Welcome to Git
Git is free software that allows you to take a snapshot of your codebase at anytime. Once you add Git to the directory of your project, then all of your files (including code, images, scripts and even the project settings) are saved and every change or keystroke is recorded, allowing you to revert back anytime. If you accidentally delete a file you can bring it back with Git. If you want to go back in time and review a method that you deleted or changed you can do that. Git is most important when you are working in teams. It allows multiple people to work on the same codebase and check-in a different times, usually automatically merging the code together.
The easiest way to get started on a Mac is to download the install here (again it’s FREE).
To learn all about Git and it’s commands, read the Git Book. It’s a great book on learning the basics and best of all it’s FREE as well. Once you have Git installed, follow the instructions here to create your first repository: Git Basics – Getting a Git Repository
Hosted Environment
Git can be run locally on your computer, you don’t need to have a hosted environment for it to work. Yet the advantage of having your code hosted allows you to work on it in different locations. Also since it’s hosted remotely it’s safe from your computer hard drive crashing and losing all your code that you worked on for all those hours. The most popular hosted environment is called GitHub. If you work for a company, more often than not they will have an account where all of the code for their apps is kept. GitHub is not free and requires you to pay for the number of code repositories you have. If you are an independent developer you will probably want to use BitBucket, it’s completely FREE and you can setup as many repositories as you need. I’ve been using it for all of my independent apps and it is fantastic!
GitBox
When I first started using Git I only used the command line as described in the Git Book above. There are a couple good applications that allow you to manage your Git repository using a GUI. You can even use Git within XCode since it has it’s own Source Control built in (File > Source Control). This works fairly well until you start using sub-projects. The tool that I use is called GitBox. It’s a very simple app that organizes your Git repositories, see all your changes and easily commit files and push to a remote hosted environment.
For more information on GitBox checkout their website. It costs $14.99, but it’s worth every penny to ensure your code is managed correctly and keeps you out of the Terminal.