SVN User's Guide: Submit Your Work

Back to SVN User's Guide

Check in Often!

Even though this section is titled "Submit Your Work", you are expected to check in every time you work on a project. This is a good habit that backs up your work to make sure you don't lose anything, keeps a record for you of what you did when, and allows you to revert to earlier versions if you mess something up.

Step 1: Go To Your Working Directory

This assumes you have a project inside a working directory, either because you just checked out starter code for a lab or assignment, because you just checked out your own code on a different machine, or you have been working on this machine already. In this example, I'm working on the project in part1 of the lab2 example that I checked out to c:\ws\2380\tomaie.

Step 2: Do Some Work

At this point, I'm going to open the solution (part1.sln) in Visual Studio and make some changes. I typed a few comments in the file main.cpp, and I added a newheader.h file to my projects. All just normal Visual Studio usage. After I close Visual Studio, I'm looking at my working directory again, and notice how things have changed. The main.cpp file has a red ! on it, indicating that it has changed. The part1.vcproj file changed as well, since I added a new file to the project. Several new files and a new sub-directory have appeared, all created either by me or by Visual Studio as I worked.

Step 3: Commit Your Changes (copy them back to the server)

Moving up a directory to my top-level working directory (c:\ws\2380\tomaie), I can see the red ! marking the part1 sub-directory, because things have changed in there. Any time you see those red !, it means you've made some changes that you should probably commit. Right-click in the directory to bring up the context menu, and select "SVN Commit".

This will bring up the commit dialogue. Here it lists everything that has changed, and you have to tell it which of those changes to include in the commit. You could just check everything, but you really don't need to. Visual Studio creates a lot of extra files everytime you compile and run, which are temporary and don't need to be saved. The only files you are concerned with are:

Notice the changed files are shown in blue and already checked. That's good.

Of all the new ("non-versioned") files, everything in the Debug sub-directory can be ignored. That's where Visual Studio compiles to. Of the last 4 files, only the newheader.h is one I created, the rest can be ignored. The part1.sln file isn't listed because it didn't change.

I also typed a comment in the big box explaining what I did. This is nice to make it easy to look back at when you made changes, so type something brief but useful.

OK that, and the commit will list all the files being pushed, just like the checkout did.

Your changes are commited! Back in the working directory, you should see the red ! go away to be replaced by nice green checkmarks everywhere. If you want to double-check, you can paste the exact same URL you used to checkout into a web browser, enter your SVN username and password, and browse your repository on the server. Click on files to view their contents.

Back to SVN User's Guide