3

I want to add local svn or git repository to my code in Xcode 4. I found help for adding that to a new project. But how do I add that to an old one?

I started working in Xcode 3. Recently I'm using Xcode 4. I want to use Time Line.

Please help.

Raiyan Kabir
  • 1,016
  • 2
  • 11
  • 23

3 Answers3

3

I was looking for an answer to the same problem. What I have done is followed the steps given by 'adymitruk' and in addition to that from the organizer window of XCode I selected 'Add Working Copy' option and selected my project folder where I had executed the git commands.

Then I double clicked the XCode project file (file with extension '.xcodeproj') from the Repository in Organizer window and that opened my project in XCode. This seems to have worked.

Some documentation from apple can be found at: http://developer.apple.com/library/mac/#documentation/IDEs/Conceptual/Xcode4TransitionGuide/SCM/SCM.html%23//apple_ref/doc/uid/TP40009984-CH7-SW10

Refer the following document's section "Add Git or Subversion Version Control to an Existing Project" which includes the Git commands: http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/SCM/SCM.html%23//apple_ref/doc/uid/TP40010215-CH7-SW9

Vishal Chaudhry
  • 2,834
  • 1
  • 22
  • 8
2

for git all you need is

git init

add a proper list of files/directories to ignore in the .gitignore file

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

then add all the files

git add . -A
git commit -m "initial code commit"

at the top level.

Similar steps for SVN but I would not recommend using SVN for a number of reasons.

hope this helps

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
  • I was actually asking how to do it using Xcode 4. There is a built-in repository system Apple has introduced in Xcode 4. I want to take advantage of it without making a new copy of the project and adding all files to that new project. Is it possible? – Raiyan Kabir Mar 22 '11 at 17:33
  • I got it in the documentation. Thanks a lot. – Raiyan Kabir Mar 24 '11 at 08:37
  • Where in the documentation? Would be good to let other people know where the answer is. – Air Mar 26 '11 at 17:50
  • http://developer.apple.com/library/mac/#documentation/IDEs/Conceptual/Xcode4TransitionGuide/SCM/SCM.html%23//apple_ref/doc/uid/TP40009984-CH7-SW10 – Raiyan Kabir Apr 02 '11 at 19:26
1

Whilst looking for the answer to this question I found this post and it's solution.

In terminal cd to the project folder you want to put under versioning

"git init"

"git add ."

reboot XCode and it should detect that it is under git versioning and you can use the internal tools

Source: I found it on this site http://www.lastrayofhope.com/2011/03/25/xcode4-adding-local-git-repository-to-a-xcode3-project/

JConway
  • 569
  • 5
  • 13