Table of Contents

SVN basics

In this tutorial, you will learn SVN basics.

SVN Server signup

You may signup one of the free SVN server, for example, https://www.assembla.com/.

Installing SVN client

You can install a SVN client from https://sliksvn.com/download/.

SVN basic commands

  1. Duplicate a working copy of repository on your local machine by checkout (similar to clone in Git):
    $ svn checkout https://subversion.assembla.com/svn/YOUR_REPOSITORY/ YOUR_DIRECTORY
    Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
    Password for 'YOUR_LOCAL_USERNAME': ******
    Authentication realm: <https://subversion.assembla.com:443> Assembla Restricted Area
    Username: YOUR_USERNAME
    Password for 'YOUR_USERNAME': **************
    A    YOUR_REPOSITORY\tags
    A    YOUR_REPOSITORY\trunk
    A    YOUR_REPOSITORY\branches
    A    YOUR_REPOSITORY\readme.textile
    Checked out revision 1.
  2. Create a new file:
    $ cd YOUR_DIRECTORY
    $ echo first line > test.txt
  3. Add and commit (similar to Git, however when you do the commit, the remote repository is updated):
    $ cd YOUR_DIRECTORY
    $ echo first line > test.txt
     
    $ svn add test.txt
    $ svn commit https://subversion.assembla.com/svn/YOUR_REPOSITORY/ YOUR_DIRECTORY
    Adding         test.txt
    Transmitting file data .
    Committed revision 2.
  4. Branching is very simple. You make a copy of your project tree in the repository using the svn copy command:
    $ svn copy https://subversion.assembla.com/svn/YOUR_REPOSITORY/YOUR_PROJECT/trunk \ 
                 https://subversion.assembla.com/svn/YOUR_REPOSITORY/branches/bug123 \
                   -m "Creating a bug123 branch of /YOUR_PROJECT/trunk."
  5. Merging example:
    $ cd bug123
    $ svn merge ^/YOUR_PROJECT/trunk