1

I know there is some question raise on this subject but it gives me no real answer.

I would like to use GIT repositories to store my project and to make some branches. I was using GIT repositories on other projects in xcode 4 but in xcode 5 under meni

 Source control

I have onelly options

Check Out

I create repositories as Apple suggested but I can't commit my code.

If I understand correctly if I Check Out my code it saves into local repo?

Laurence
  • 58,936
  • 21
  • 171
  • 212
Marko Zadravec
  • 8,298
  • 10
  • 55
  • 97

2 Answers2

1

As described in "How To Use Git Source Control with Xcode in iOS 7", you could:

  • create a new project:

http://cdn4.raywenderlich.com/wp-content/uploads/2013/09/Screen-Shot-2013-09-24-at-6.22.37-PM.png

  • make sure to select the "create git repository" option

http://cdn1.raywenderlich.com/wp-content/uploads/2013/09/Screen-Shot-2013-09-24-at-6.22.48-PM-480x54.png

  • and then copy your source in that new repo.

For that project, you should see more than just "Check out" in the "Source Control" menu:

http://cdn3.raywenderlich.com/wp-content/uploads/2013/09/Screen-Shot-2013-09-24-at-6.34.47-PM-e1380066015693.png

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Yes I see this, but what if I already has project in run. (I can't create new project) – Marko Zadravec Nov 14 '13 at 07:56
  • @MarkoZadravec easier to create a new project, and import your sources in it. But if you really can't create a new proejct (not sure why), then try to create a git repo in command line where your project is. I wouldn't recommend this. – VonC Nov 14 '13 at 07:57
  • Aha so there is no easy solution without creating new project. Can others then download same code from this repository or they should create new project and then download from repo? – Marko Zadravec Nov 14 '13 at 08:18
  • @MarkoZadravec no: other will clone this repo (supposing you pushed said repo in a git hosting service, like GitHub or BitBucket or...), which should be recognized by XCode5. My solution was for a new project not yet versioned. – VonC Nov 14 '13 at 08:19
  • Yes I will push it on git server (my own, not GitHub,...). Thanks for you info. – Marko Zadravec Nov 14 '13 at 08:21
0

I just find a post https://stackoverflow.com/a/11021627/411936 which solves this problem. I worked for me. Hope it helps.

1.  Quit Xcode (not sure if this is necessary but I do it just in case)
2.  Run Terminal
3.  Get into the project folder directory
4.  find .
5.  Find the file that says "UserInterfaceState.xcuserstate" and copy the entire filename up to the ./
6.  echo "paste the UserInterfaceState.xcuserstate file here" >.gitignore
7.  cat .gitignore
8.  git init
9.  git add .
10. git commit -m "You can type a comment here like now under source control"

You now have a repository and your project is under source control

Community
  • 1
  • 1
zapoo
  • 1,548
  • 3
  • 17
  • 32