views:

1022

answers:

9

This is probably a really stupid newbie-sounding question to you developer type people, but I'm at a loss :( I've been trying to learn how to use Subversion for keeping the history of my code, but I'm finding it pretty confusing. I read the 'book' that comes with Subversion, but I didn't find it all that helpful. I'm using Windows, and I downloaded the TortoiseSVN GUI for it.

All I really want to know how to do is to create a new project, put a file in it (any old file), and then update that file, just so I can see how it works. I created a 'repository' (in svn_repository/test), and if anyone could tell me how I'm supposed to go about creating a new file/putting a file in it, and then updating that file I'd be really happy :) Knowing my luck it'll be something as simple as "drag and drop the file into the directory". Apologies for asking such a stupid question!

Also if anyone could tell me how to go about making it work with Zend Studio, that would be extra awesome-points. Thanks!

+3  A: 

Have a look at this question its got some good pointers on starting with svn

Darren
+1  A: 

The repository is a place where Subversion itself manages the files - you will not access the files in the repository directly. If you've created a repository, then the next step is to do a Checkout from the repository to some working directory. (This working directory should not be a subdirectory of the repository.)

Once you have a checkout, drop a file in there and right click on it to Add it. The other operations should make more sense from that point.

Greg Hewgill
Thank you so much! :)
nationale
+3  A: 

I really like using AnkhSvn in conjunction with Tortoise. It works from Visual Studio. When I set up my own repository, I used VisualSVN, which took 2 secs to run, and didn't involve any apache or LAMP stuff. Just worked out of the box. As far as using it, try the free book online to get a feel for what source control is all about. Then go to a website, like http://blog.taragana.com/index.php/archive/5-minutes-guide-to-subversion/ for a quick tutorial of how to use it.

Ben
+1  A: 

I found TortoiseSVN to be terribly confusing, especially in conjunction with the SVN Book. But then again, I'm not a very GUI oriented person.

Work through the book using the command line SVN client, until you understand the basic concepts. Don't skip any chapters!

Then you can evaluate GUIs, if you even need one by then.

slim
+9  A: 

The recommended directory structure for a subversion repo contains three folders: "branches", "tags" and "trunk". So, create these folders somewhere convenient, in a new folder.

Right click in the parent folder of these folders, go to TortoiseSVN and select Import. Enter the url to the repository you created here (ie_ https://JUNK:8443/svn/Test/ is one I just made, on my local machine). Hit the ok button and the folders will be imported.

Now browse to where you want the repo to live on your local machine (I've gone to C:\workspace\test). Right-click and go to SVN Checkout.

Now, you want to check out from the trunk of your repo, so change the repository URL to reflect this (https://JUNK:8443/svn/Test/trunk/). Hit the ok button.

Create a new file in this directory. Right click on it and go to TortoiseSVN, then Add. Hit ok, and the file is now marked as a new file for the repo. Right click in the parent folder of the file and you should see SVN Update and SVN Commit. SVN Update will refresh the local files with files from the repository. SVN Commit will send local files that have been changed back into the repository.

Have fun :)

rjohnston
+2  A: 

Often when I create a new project I have to refer to the SVN Quickstart guide.

It takes you through creating a new repository, the initial import, and how to check your files out and back in (on the command line).

The book is very helpful, but you'll get the best value out of it after you've been using version control for a little while and understand the concepts better.

(Note the terminology in bold below)

If you're using TortoiseSVN, you'll have to create the repository, and then import your files (if you have any) when starting up. After that you check out the project to a working folder and can just create files in the working folder and then add them easily. Once the repository is created you only interact through it via your Subversion client.

Harley
+1  A: 

The SVN Book has an appendix called "Subversion Quick Start Guide" that goes through the very basics quickly. Here is a quick overview.

For the initial setup, I create a temporary folder on the SVN server where I'll setup the structure of my site. This is just a temp folder and I delete it once I've done the initial setup. I usually call this something like C:\tmpRepository. I then create a new folder in there for my project name. So lets say your project name is test. I would create c:\tmpRepositories\test. Inside that folder create three folders: branches, tags, trunk. Then copy your project files into the trunk directory.

Now open the command prompt and type the following to create the new repository. svnadmin create c:\AppRepositories\test. I just keep all my source code in the AppRepositories folder and then just setup each project with a new folder.

Next we need to load our new repository with the files in our temp directory. So with the command prompt open we run: svn import c:\tmpRepositories\test file:///c:/AppRepositories/test -m "initial import"

That's it! Then on your development computer you should install TortoiseSVN. You will want to setup a location on your computer where you will store the working copy of your files. I typically just create a folder on the C: drive called "WorkingCode." Open that folder, right click and choose SVN Checkout. Under URL of repository type in svn://servername/test. Make sure checkout directory is correct.

BAM! You should now see all your code files in the trunk directory (c:\workingcode\test\trunk).

Erikk Ross
A: 

The prags wrote a good book on using Subversion: http://www.pragprog.com/titles/svn2/pragmatic-version-control-using-subversion

Joshua
+1  A: 

You asked for a one-file project, so here it is. I'm not familiar enough with Tortoise to run you though it that way, but I'll list the commands and hopefully you can figure out for yourself how to do each step by right-clicking in File Explorer. There are only actually five things you need to be able to do: create a repository, check out, "add" a file to make it version-controlled, check in, and log. The rest will come later.

Also, someone might search on leanring subversion later who isn't using Tortoise, and they'll find this question.

# create an empty repository
svnadmin create myrepos

# check out a working copy of the empty repository
svn co file://full/path/to/myrepos workingcopy

# create an empty file in workingcopy (nothing to do with SVN - use 
# File > New > Text Document if you like)
cd workingcopy
touch mycode

# place it under version control, then tell the repository what you've done.
svn add mycode
svn ci -m "My first ever checkin comment! File created."

# Now we're developing. Go edit the file. Come back when you're done.

# Check it back in
svn ci -m "First version of project"

# Go edit it again

# Check it in again
svn ci -m "Made my project better"

# See what we've done so far
svn log mycode

That's it. That's the bare minimum you have to do to version-control a single file. Now go re-read the start of the SVN book, delete myrepos, and start over, because you'll probably want to structure your first proper repository in the way it tells you to.

Steve Jessop