Subversion basics

Операция Official client TortoiseSVN
checkout
(create new working copy) (*)
svn checkout https://svn.dev.ws/svn/test/trunk
(svn co [URL])
  1. Create directory
  2. Navigate it with explorer
  3. Click Right Mouse Button
  4. Choose "SVN Checkout" from pop-up menu
  5. Fill "URL" field and other values
  6. Click OK
update
(update working copy) (*)
svn update (svn up)
  1. Right Mouse Button
  2. "SVN Update" in pop-up menu
commit
(save changes to repository) (*)
svn commit (svn ci)
  1. Right Mouse Button
  2. "SVN Commit" in pop-up menu
stat
(examine working copy status) (*)
svn status (svn st)
  1. Right Mouse Button
  2. "TortoiseSVN" in pop-up menu
  3. "Check for modification" in pop-up menu
diff
(review changes)
svn diff (svn di)
  1. Right Mouse Button
  2. "TortoiseSVN" in pop-up menu
  3. "Create patch" in pop-up menu
switch
(WC to new repository URL) (*)
svn switch [новый URL] (svn sw)
  1. Right Mouse Button
  2. "TortoiseSVN" in pop-up menu
  3. "Switch" in pop-up menu
  4. Enter new URL
  5. Click OK
add
(add file/directory to working copy)
svn add [file/dir]
  1. Right Mouse Button
  2. "TortoiseSVN" in pop-up menu
  3. "Add" in pop-up menu
  4. Select files
  5. Click OK
remove
(remove file/dir from WC) (*)
svn remove [file/dir] (delete, del, remove, rm)
  1. Right Mouse Button
  2. "TortoiseSVN" in pop-up menu
  3. "Delete" in pop-up menu
copy
(to create branch/tag, for example) (*)
svn copy [URL1] [URL2] (svn cp)
svn copy \
  https://svn.dev.ws/svn/test/trunk \
  https://svn.dev.ws/svn/test/branches/private_vnaum
          
  1. Right Mouse Button
  2. "TortoiseSVN" in pop-up menu
  3. "Branch/Tag" in pop-up menu
  4. Enter new repository URL
  5. Enter commit message
  6. Click OK
revert
(local changes)
svn revert
  1. Right Mouse Button
  2. "TortoiseSVN" in pop-up menu
  3. "Revert" in pop-up menu
log
(view changelog)
svn log
  1. Right Mouse Button
  2. "TortoiseSVN" in pop-up menu
  3. "Show Log" in pop-up menu
merge
(apply changeset from repository to WC) (*)
svn merge -r N:M SOURCE[@REV] To merge revisions you need to go to a working copy of the branch in which you want to receive the changes, often the trunk. Select Merge... from the context menu.
  1. In the From: field enter the full folder url of the branch or tag containing the changes you want to port into your working copy. You may also click ... to browse the repository and find the desired branch.
  2. Because you are porting a range of revisions from the same branch into your working copy, make sure the Use "From:" URL checkbox is checked.
  3. In the From Revision field enter the initial revision number. This is the revision before the changes you want to merge. Revision numbers are auto-incremented after each commit. You want to start merging the changes before the revision number is auto-incremented. For example, if your log messages look something like this:
    Rev Comments
    39. Working on MyBranch
    38. Working on trunk
    37. Working on MyBranch
    36. Create branch MyBranch
    35. Working on trunk
    34. Working on trunk
             ...
                

    If you now want to merge the changes from MyBranch into the trunk you have to choose 36 as the From Revision. Not 37 as you might think.

    The easiest way to find the revision you need is to click on Show Log, as this will list recent changes with their log comments. Select the revision you require in the Show Log dialog, then click on OK.

  4. In the To Revision field enter the last revision number in the range you want to merge. Often this will be the HEAD revision, although it doesn't need to be - you can just want to merge a single revision.
  5. Click OK to complete the merge.

Official command-line client

Grab it from http://subversion.tigris.org/files/documents/15/35379/svn-1.4.2-setup.exe .

Perfectly documented in Version Control with Subversion. Works on any OS out there. This client will be installed on development and production boxes. Has built-in help for every command (for "svn checkout" - "svn help checkout", and so on).

I strongly recommend this client for starters.

TortoiseSVN

Grab it here: http://prdownloads.sourceforge.net/tortoisesvn/TortoiseSVN-1.4.1.7992-win32-svn-1.4.2.msi?download

Popular client for Windows. Implemented as a windows shell extension (you will need to click with right mouse button on everything). Pretty good help file in chm format. With excerpts from The Great Book (Version Control with Subversion).


Footnotes:

checkout:

You can checkout any directory / branch from repository. You can even checkout whole repository (like that: svn co https://svn.dev.ws/svn/test/), but beware - "cheap copies" are only cheap in repository, not on your hard drive! And if single branch takes 100Mb, 10 branches will take 1Gb.

update:

update, like almost every operation in SVN, works on current dir recursively. And, like almost every operation, you can explicitly tell it what (and how) you want to update:svn up -r 10 file - update file file to revision 10. You can update to any past revision.

commit:

By default it commits current dir recursively. You can explicitly tell what you're going to commit. Before committing you'd better once again review your changes with svn diff, it will help you to write better commit message. This is how I do my commits: svn diff | gview - ; svn ci

stat:

There are a lot of letters in stat output. Most popular are M - modified file, A - added file, D - deleted file. Full legend is available here: http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html#svn.tour.cycle.examine.status

switch:

Always check output of this operation. If switch fails, you can by mistake commit your changes on wrong branch.

remove:

This operation can be done server-side - just put an URL in repository instead of WC path.

copy:

This operation can be done on WC, too - just put a WC path instead of URL in repository.

merge:

Check Starters Guide.