How to add a new project to source control in Xcode 4?
Asked Answered
L

3

16

How do I add a new project to source control (SVN) using Xcode 4?

Linettelineup answered 11/4, 2011 at 8:31 Comment(1)
use the command line ("svn import") and then open the project again. it should work.Lore
L
20

Open Organizer. Click on the root of your SVN repository in the tree on the left. Click on Import on the bottom right and choose the directory from finder that you want to add and click Import.

This will add the project to SVN

Linettelineup answered 11/4, 2011 at 8:48 Comment(2)
One thing to be aware of here... Xcode apparently doesn't have a default svn:ignore. So, if the project was previously under git (or you want local git with remote svn) this import will add the .git directory. It will also add other user directories and files that you may or may not want under source control.Springs
What is SVN? What does it stand for?Moulmein
D
6

The XCode 4 documentation recommend using command-line tools or a utility program to set up a Git or Subversion repository.

To set up a Subversion repository using the command line

1/ Open the Terminal utility and use the svnadmin create command to create a Subversion repository.
For example, if you want a repository named Sketch_svn in the existing location /Users/myUserName/Repositories, you would enter the command:

  svnadmin create /Users/myUserName/Repositories/Sketch_svn

Tip: The easiest way to get the full path to a folder into Terminal without risking typing errors is to first type the command (cd in this case), enter a space, and then drag the folder from the Finder and drop it at the end of the Terminal command line.

Note that the directory /Users/myUserName/Repositories/ must already exist before you execute this command. You can use the Finder or a mkdir command to create the directory.

2/ In another location—not in the repository you just created—create a folder to hold a temporary copy of the project. In that folder, create three additional folders named branches, tags, and trunk.

3/ Create a new Xcode project in the trunk folder, using Xcode, or put your existing project in the trunk folder, using the command line or the Finder.

4/ Use the svn import function to import your project into the repository you created and place it under Subversion source control.
For example, if your temporary copy is in /Users/myUserName/Projects/Sketch_tmp, you would enter the following command in Terminal:

svn import /Users/myUserName/Projects/Sketch_tmp \
  file:///Users/myUserName/Repositories/Sketch_svn -m "Initial import"

Notes

  • The backslash at the end of the first line indicates that the command is continued on the next line. You can omit the backslash and type the entire command on one line. If you do use the backslash, be sure there are no spaces following it before you press Return.
  • There are three forward slashes in the string file:///.
  • If you type the entire command on one line, be sure there is a space before file:///.
  • You can include any comment you want in the quotation marks, but be sure your comment will be meaningful to anyone using the repository.

5/ In the repositories organizer in Xcode, click the Add (+) button at the bottom of the navigator pane, and choose Checkout Repository to create a working copy.

Disembark answered 11/4, 2011 at 8:47 Comment(1)
I hate squandering time on stuff like this instead of programming, but anyways thanks for your help! It works in Xcode6.3 too!Jowl
S
0

Use Terminal. At the command line, you can use the svn import command to add the project to your repository.

From the way you worded your question, I'm assuming that your subversion repository already exists. You'll follow the same basic steps outlined in Add Git or Subversion Version Control to an Existing Project in the Xcode 4 Users Guide, except that instead of creating a whole new repository you'll just add a new directory to your existing repository.

It's handy that Xcode has support for version control, but it's not a full-featured GUI version control client. You should still know how to manage your repository using the svn command line program. Alternately, you can get a GUI front end like Versions. Either way, you should have (and have read) the Subversion Book. There's a lot more to using version control than just checking files in and out, and you need to know how it works and how best to use it if it's going to help you.

Sac answered 11/4, 2011 at 8:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.