Svn Commands

1. Svn commands on server

Create a repository – in order to create a svn repository(server) you need access on the server machine. The command can work only locally and it can not work on network paths:

// Windows:
svn admin c:\\svn\serverfiles\

// Linux:
svn admin /svn/serverfiles/

Start the server – to start a server you must run the following command(if svnserver is not present in the path you can add it or you can use the full pathname).:

svnserve --daemon --root c:\\svn\serverfiles\

svnserve --daemon --root /svn/serverfiles/

//To see all the options:
svnserve --help

2. Client Commands

Considering we have a svn server installed with a repository created, and the server is up and running, let’s add a new project to the repository(the svnserver can run on the same machine, but it’s still a server). To begin with let’s create the following structure, putting the files of out project inside the trunk server.

Once done run the following command to add the project structure in the new repository on the server and to commit the first version:

svn import project file:///c:/projects/project -m "Initial Version"

svn import project file:///projects/project -m "Initial Version"

svn co
svn add –force .
svn commit -m “this is a message”

show changed files:
svn log -r 1:2 -v

Ignore Command:

Ignore a file:
svn propset svn:ignore .project .

Ignore a directory and all the files inside it:
svn propset svn:ignore ‘*’ classes/

If the location of the repository is changed you can use the following command to switch the local working copy(checked out from the old location of the repository), to the new one:
svn switch –relocate svn://

svn switch –relocate svn:// \

Did you enjoy this tutorial? Be sure to subscribe to the our RSS feed not to miss our new tutorials!
... or make it popular on

Leave a Comment.