SVN Commands That Every Programmer Must Know:

Hi Guys,Today I am writing some basic  svn command that I strongly feel any professional developer must know while working on Linux machines.
The aim of this tutorial is to guide developers by covering the basics of the command-line subversion usage, via the svn command.

As all of  you might be knowing,Subversion(svn) is a version control system that keeps track of changes made to files and folders, facilitating data recovery and providing a history of the changes that have been made over time.

Below is the list of all basic svn commands:
1.svn checkout/co:This command is used to check out your code.
svn co svn://svnrepo.
This will checkout the code from the svnrepo with the latest version. If you want to checkout the code for any specific revision number then use this command:
svn co -r <revision number> svn://svnrepo

2. svn add: When you create a new file or directory, you need to tell the SVN server about it. This command does that.
svn add  <your file or directory name>

3. svn status: This command prints the status of working directories and files. If you made local changes then it’ll show (M) status in front of your file name.
svn st

4. svn update: This command is used to update your code from svnrepo.
svn up
This command will update your directory with the latest version. If you want to update your code or want to revert back with any specific revision number you can use:
svn up -r <revision number>

5.svn delete:  This command is used to delete file from svnrepo.
svn delete <your file name>

6.svn commit: This command is used to commit your code to svnrepo.
Remember when you use svn add or svn delete, you have to commit your code by using svn commit command. After that your changes will reflect in svnrepo.
How to use svn commit:
svn commit -m “<your message>”.
If you want to commit only a specific file or any specific directory then use this command:
svn commit -m “<your message>” -r <revision number>

7. Create new branch from your svnrepo: Creating branch using command line is very easy. Command that is used for creating branch:
svn copy svn://svnrepo  svn://yourbranchname .
If you want to create branch for any specific revision number then use this command:
svn copy svn://svnrepo  svn:yourbranchname -r <revision number>.So I hope I’ve given you some idea of how to manage the basics of command-line subversion. I will try to write next post with some more advanced examples.


About learningtechstuffs

I'm Ansu Jain. I have 1.5 years of experience in iPhone development and 1.5 years of experience in web technology. I have worked on a number of web framework including Drupal, Django, Moodle, Pinax, NodeJs. This blog is dedicated to things I feel that each developer must know.
Gallery | This entry was posted in Uncategorized and tagged , , , , , , . Bookmark the permalink.

4 Responses to SVN Commands That Every Programmer Must Know:

  1. saurabh says:

    Good read for newbie developers, Above has good basic information about subversion(SVN) in precise and concise way.. 🙂

  2. vaibps17 says:

    Thanks Ansu for compiling this.

  3. r15habh says:

    Good read. I will like to add one more command which is especially useful for people using Rabbit VCS. The problem is, when you normally delete some file in order to get the latest copy from svn it sometimes doesn’t show up. So to get the latest file use svn export

    svn export [-r REV] URL [PATH]

    It Exports a clean directory tree from the repository specified by URL, at revision REV if it is given, otherwise at HEAD, into PATH. If PATH is omitted, the last component of the URL is used for the local directory name.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s