XCode & Git

Ok, i just started getting my feet wet in this but here is the scoop!

Git is a versioning technology which allows you to create multiple versions of your project much like TimeMachine on your Mac.  The whole point behind it is that at any time you can go back to a specific project mod and retake it from there.

The first step is to GITTIFY your folder.  You can either do this manually from the command line or from Xcode by creating a new project and check marking the Use Git Repository option.  Since you are using Xcode simply check the box for Git in your new project.

Now you create your project files and whatever.  Then move to Xcode->Organizer and click on the REPOSITORY icon which will take you to a window where you will see a project name folder on the left hand side; mine is called eraseme so I’ll use that name to mean ‘project folder’ from now on.

 

XCode Git Repository Santiapps.com by Marcio Valenzuela
XCode Git Repository Santiapps.com

You also have a yellow Branches, a yellow Remotes & blue project folder.

In the yellow Branches folder, create your master branch now by selecting Add Branch or by doing “git push eraseme master” in terminal from within your eraseme folder.

Finally go to the Remotes folder and Add Remote to enter your online repository’s url.

You’re all set!  You can begin sharing your project files now.

3 Replies to “XCode & Git”

  1. Very nice and useful! I’ve always glanced past the git feature x] are the git repositories always open? Or can you use git with a closed source project? I just don’t want everyone seeing source code to my commercial apps.

    1. You mean local repo or remote? This is what usually confuses people. Git creates local repositories as a basic feature.

      Remote repositories are an optional feature and a very useful one of course. You can create a git server on your machine to run your own “cloud” repository or you can use a “cloud” repository such as the one at github.com and others available online.

      Most of those online repo services are free for a public (everyone can view it) but require monthly fees for private repos.

    2. The git is a local feature and as such is private (in your computer). If you decide to share online via something like github, then you can decide whether to make the repo public or private. BTW, if you have a free github account, the only repo you can have is a public one.

Leave a Reply