Git is a distributed source control system (like subversion) – still not sure what it is and if you need it? Take a look at this crash course.
GitHub is a web-based hosting service for software development projects that use the Git revision control system. GitHub offers both commercial plans and free accounts for open source projects.
This is how we set up Xcode 4 and GitHub to work together on the Mac for a new iOS (iPhone or iPad) project. We’re assuming Mac OS Version 10.6.8, Xcode version 4.02 and the latest version of Git.
- Register as a new user with GitHub. You can host public open source projects on GitHub for free – if you need private projects you will have to sign up for a paid plan.
- Follow GitHub set up steps 1 & 2.
- Create your new project in Xcode – check ‘create local git repository for this project’ within the wizard when asked.
- Create a README file and add it to the main directory of your Xcode 4 project.
- On GitHub create a new repository with the same name as your Xcode project (it doesn’t have to be same name but keeps things simpler).
- After creating the new repository (or ‘repo’) on GitHub – follow the ‘Existing Git Repo?’ directions on GitHub.
- Now as you make changes in your Xcode source code or project – you can commit them with the standard Xcode command – File -> Source Control -> Commit.
- After committing your changes you can push them to your remote repository on GitHub from the command line (from your Xcode project directory) using ‘git push -u origin master’.