-1

I've read that developers really need source control. Now I never used it before and I'm a bit lost with my existing projects.

How do I setup it?

There's already a File path inside of it, but it goes to nothing? I don't even know what it does in there.. I want a local git for my own. I found how to set it up with Terminal. But I think there should be a right way on doing this with Xcode and not with Terminal?

First image off Xcode Second image of Xcode

Cœur
  • 37,241
  • 25
  • 195
  • 267
Kets
  • 438
  • 2
  • 8
  • 24
  • You should specifically google "git in xcode" if that is what you want to know. [Here is a result](http://www.cimgf.com/2013/12/10/using-git-in-xcode/). If you don't know anything about Git, there is [this stackoverflow question](http://stackoverflow.com/questions/315911/git-for-beginners-the-definitive-practical-guide). [And this question about git and xcode](http://stackoverflow.com/questions/8410129/tutorial-on-git-with-xcode). – Leiaz May 09 '14 at 17:33
  • Just realized that the *existing project* part could make this more difficult *in XCode*. But with git on the command line, [it's completely straightforward](http://stackoverflow.com/questions/5383609/using-git-with-an-existing-xcode-project). On a new project, I guess it just does the init for you. – Leiaz May 09 '14 at 17:59
  • 1
    Just run `git init` and `git add .` in the project's directory. From there, you can use all the GUI front-end features of Xcode's source control. – esqew May 09 '14 at 18:22

1 Answers1

1

I'm sorry to say that Xcode does not have an option to place an existing project under version control. You can however use GitHub for Mac which will allow you to do this. It also has convenient merging tools and lets you push your code to GitHub.com if you like, all at the touch of a button: https://mac.github.com

It's easy enough to create a git repo from the command line though: open Terminal and navigate to the root folder of your project. Then type the following:

git init
git add .
git commit -m "initial commit"

Note that this approach as well as GitHub for Mac will version control every file in your project - which is not what Xcode does when you start a new project with Git enabled. You may run into trouble because your user interface state changes once every second - which can make committing and merging difficult.

The following article discusses this in detail: http://pinkstone.co.uk/how-to-place-an-exiting-xcode-project-under-version-control-with-git-and-ignore-files-you-dont-want-to-track/

Jay Versluis
  • 2,062
  • 1
  • 19
  • 18