28 marca 2011

Github + xCode 4

After 2 days of messing up with xCode 4 I came up with a complete solution on how the Git works inside xCode 4.

First of all, we have to understand two main concepts:
- Local repository (repository that is stored inside your computer)
- Remote repository (repository that is stored online)

As far as I understand, xCode can perform JUST such tasks:
- Work with local repository - make commits (push command)
- Work with remote repository - pull server-saved folders (repositories)

It's a bit weird that it can't make commits to remote repository.

First, make github's account, make repository, follow the GitHub help's steps (1 and 2).
Let's now start making our first project and make it storable online on the remote repository.
  1. Make a new project in xCode
  2. When prompt in choosing the path, select "Create local git repository for this project"
  3. Now you can make changes in your project and commit changes to the LOCAL repository throught Organiser -> Repositories -> YourProjectNameRepo -> YourProjectNameFolder -> Commit
  4. If you wish to make commits to the Remote repository, just go to Terminal, navigate to your Project's main folder and execute: git push origin master
  5. All your LOCAL commits will be sent to REMOTE repository
If you have a friend that would like to continue working on your project or just work with you on it he can use xCode's second feature.
  1. Go to Organiser -> Repositories -> + -> Add repository... -> Type in your GitHub's repository name -> Paste either SSH path or https, both work.
  2. Click Clone
  3. Show xCode where to Download existing repository
  4. Start working on the project, commit as above.
What about .gitignore and .gitconfig?
xCode when making Local repository handles correct .gitignore and .gitconfig, you don't have to mess up with that. Thanks to (buggy) xCode 4.

Archiwum bloga