Wednesday, December 28, 2011

Top 10 Examples of SVN Commands

Top ten Examples of SVN Commands

SVN commands are used by most of the developers when there is project development involves multiple locations by different teams.

I am listing down the some of the frequently used commands

How to find the SVN version?

E:\techrocksz>svn --version
svn, version 1.6.12 (r955767)
   compiled Jun 21 2010, 16:00:59

Copyright (C) 2000-2009 CollabNet.

This will display the current svn client version

 How to find different commands available in the SVN tool?

E:\techrocksz>svn help
usage: svn  [options] [args]
Subversion command-line client, version 1.6.12.
Type 'svn help ' for help on a specific subcommand.
Type 'svn --version' to see the program version and RA modules
  or 'svn --version --quiet' to see just the version number.

Most subcommands take file and/or directory arguments, recursing
on the directories.  If no arguments are supplied to such a
command, it recurses on the current directory (inclusive) by default.

Available subcommands:
   blame (praise, annotate, ann)
   changelist (cl)
   checkout (co)
   commit (ci)
   copy (cp)
   delete (del, remove, rm)
   diff (di)
   help (?, h)
   list (ls)
   move (mv, rename, ren)
   propdel (pdel, pd)
   propedit (pedit, pe)
   propget (pget, pg)
   proplist (plist, pl)
   propset (pset, ps)
   status (stat, st)
   switch (sw)
   update (up)

Subversion is a tool for version control.

This command will list down all the available commands (Add, checkout etc..) in svn client tool.

How to Checkout from SVN

Checkout means creation a local workable copy of your project retrieved from the remote repository.

Let us say you have a project located in a repository created at URL location
so you have to check out my project into your local system assuming myrepo is a public repository.

svn co

It will copy all your files located in my project to the current directory.

if you want to check out the directory which is not located in a public repository i.e private repository which is specific to your company. Then you have to give one more option--username and --password

svn co --username admin --password admin

How to do check in to svn:

When the code is changed, your changes are in your local repository and changes are not available in the repository. if you want to have changes available in the repository, you need to check in the code.

svn commit -F "Commit changes" list of files by space

Compare/diff files in svn

You can check the status of the files by using the command

svn diff

diff command is used to check the difference between versions
svn diff
---   (revision 0)
+++   (revision 0)
@@ -0,0 +1 @@
+This is comment added for svn-basics.

Property changes on: