Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Basic SVN Usage

Preface

Let me start off by saying that I'm a relatively new programmer and I have no prior experience with source control -- although after some reading, the concepts and general lingo are not alien to me.


Background

I'm about to start my first professional project (I'll be the only one committing) and I'd like to take this opportunity to become proficient with Subversion and source control practice in general.

  • Development will take place on a Windows box in Visual Studio with the help of the AnkhSVN SC plug-in.

  • I've setup SVN on a Windows server and created a repository where I'll store my project(s).

  • This particular project will require delivery of binaries and source code.


Questions

  1. How is solution building usually set up? Say I've imported an initial version of the solution into the repository; next, I've achieved some milestone in my local working copy; I commit those changes; what happens then? Do I just build the solution on my local development machine and package the binaries right there and then? How is this done in the real world?

  2. After messing around with VS and AnkhSVN in a VM, I've noticed that after I checkout some revision of a solution, my local copy's directory tree gets an extra directory called ".svn" in each node. As per the third point in "Background", I'll also be delivering source code along with the binaries. This poses a question: how do I get a "clean" version of my solution? Am I expected to write a shell script that does the cleaning for me?

  3. I often create, merge (by hand, that is), and delete files in my solutions. Will SVN (rather VS and AnkhSVN) handle this gracefully? Will VS/AnkhSVN automatically reload a solution that had files added/removed from it if I go back to a certain revision?

  4. Where did you learn to use source control, and how long did it take you to become proficient (i.e., until these operations were second nature) at it.


I really want to start using source control, but I'm scared that if I start using it and I do something unintentionally stupid, I'd lose my code. Any extra advice is appreciated.

like image 408
Sycorax Avatar asked Jul 27 '09 18:07

Sycorax


People also ask

What is svn is used for?

SVN stands for Subversion. So, SVN and Subversion are the same. SVN is used to manage and track changes to code and assets across projects.

Is svn free for commercial use?

VisualSVN Server is freely available for commercial use under the Community license.


1 Answers

  1. Normally, packaged binaries are not kept in source control. If anything, use a separate repository for them. As a matter of fact, try to keep binaries away from your repository if at all possible. No compiled versions of your source code. (see comments as well)
  2. Get TortoiseSVN for use in Explorer. You can use the Export option (as opposed to checkout) for a clean version of the directory. Use a separate directory for this.
  3. Visual Studio will ask you if you want to reload projects or solutions that have changed. You will need to make sure that you check in a project at the same time as your added / deleted file though. It won't give you problems now, but it would if you were working on this with more than one person or if you want to revert to an earlier version later.
  4. Here and there :) Took me a month or so of regular usage to get it right *

I've used AnkhSVN in the past and it's nice, but if you have large solutions with lots of files, you might want to shell out some cash for VisualSVN. It uses TortoiseSVN (which in term has some caching mechanisms), making it faster (see comment below about AnkhSVN 2.0). VisualSVN will also help you a little in setting up properties on special directories. It will automatically ignore bin and obj directories for instance.
I'm not a big fan of paying for a product leaning so heavily on a free project, but I have to say the investment was worth it.

Other people have linked some nice sources on how to set up your repository, so I won't go into that too much. I generally use the /trunk, /branches, /tags approach myself. Tag your release versions at least, to find them quickly later.

Ad 4:
I've worked with CVS (very little), Visual SourceSafe, Subversion and Team Foundation Server so far. I mean to try Git at some point, but you could do a lot worse than SVN.

like image 60
Thorarin Avatar answered Oct 09 '22 08:10

Thorarin