Change repository location of your local copy

svn switch --relocate <current_repository_url> <new_repository_url>

If using svn+ssh and the user needs to be changed use this syntax for the repository URL:


Revert to a previous revision (undoing changes)

svn merge -r <current revision>:<previous revision> .

This will only alter your local copy. Then you will need to commit these changes.


svn merge -r 801:795 .
svn commit -m 'Reverted to revison 795'

Recursively applies changes from revision 801 to 795 (backwards):

  • applies changeset to get revision 800
  • applies changeset to get revision 799
  • applies changeset to get revision 798
  • ...
  • applies changeset to get revision 795

Reference: Subversion: Undoing Changes

Create a new branch (from trunk) and switch local copy to it

svn cp <repository_url>/trunk <repository_url>/branches/my_branch
svn switch <repository_url>/branches/my_branch

SVN server

Launch SVN server as a daemon:

svnserve -d -r <folder_path>

The repositories in the folder are accessible at this URL:


Example: there is a repository folder named “toto” on in /Users/jerome/svn. First I launch the SVN server:

svnserve -d -r /Users/jerome/svn

Then I can access it:

svn checkout svn://


Checkout syntax

svn co --username jerome svn+ssh:// maestric2008


  • no colons between server name and folder path
  • ssh username is choosen with --username

Use a custom SSH port

On the client, edit ~/.subversion/config. In the tunnels section add

sshhome = ssh -p 2222

Then when you checkout:

svn co svn+sshhome://...

Prevent .svn folder web access with .htaccess

RewriteRule ^(.*/)?\.svn/ - [F,L]
ErrorDocument 403 "Access Forbidden

Properties on folders

Set a property:

svn propset <property_name> '<property_value>' <folder_path>
svn propset my_info 'exxxtreme' photos/other;

To set several values, use a text file, one property per line:

svn propset <property_name> -F <file_path> <folder_path>

Delete a property

svn propdel <property_name> <folder_path>

List properties

svn proplist -v <folder_path>

Example: ignore HTML files in toto folder

svn propset svn:ignore '*.html' toto

Display ignored files

svn status --no-ignore


Show author and revision information for each line:

svn blame <file>

Subversion SVN bug with SSH: "Name or service not known"

SVN over SSH (svn+ssh) stopped to work one day, I don't know why:

svn update
ssh: Name or service not known
svn: Connection closed unexpectedly

When performing an svn info:

Path: .
URL: svn+ssh://

I noticed a colon had been added between the hostname and the repository path! To fix it I did:

svn switch --relocate svn+ssh:// svn+ssh://

Add new files (recursive)

svn add --force *


Delete missing files (recursive, works with spaces in file name)

svn status | grep '^\!' | cut -c8- | while read f; do svn rm "$f"; done