SVN COMMANDS

As I discussed earlier that we conduct very interesting event in our Apptility that is 3:30@Lab. So this time one of software engineer discussed this topic:

21 SVN commands every serious developer should know.

I am trying to post some parts of that session over here. Hope that it will be useful for that guys who are working on Open Source.

1. Help:
Before reading on, here is the most important command you’ll ever need when using Subversion: svn help. The Subversion command-line client is self-documenting—at any time,.

$svn help
Will display all available subcommands in svn. A quick svn help SUBCOMMAND will describe the syntax, switches, and behavior of the subcommand:

$svn help checkout

2. checkout: Check out a working copy from a repository.
Syntax:

$svn checkout URL… [PATH]

ex: This copy contains the HEAD (latest revision) of the Subversion repository that you specify on the command line.
$ svn checkout http://openappdotorg.googlecode.com/svn/trunk/

Although the above example checks out the trunk directory, you can just as easily check out any deep subdirectory of a repository by specifying the subdirectory in the checkout URL:

$svn checkout http://openappdotorg.googlecode.com/svn/trunk/tests/
To checkout a specific revision:
$svn checkout -r 8810 http://openappdotorg.googlecode.com/svn/trunk/

If you have username and password in repository then
$svn checkout http://openappdotorg.googlecode.com/svn/trunk/ –username <USER> –password <PASSWORD>

3. update: Your Working Copy
$ svn update
If no revision given, bring working copy up-to-date with HEAD rev.
Else synchronize working copy to revision given by -r.

For each updated item a line will start with a character reporting the
action taken. These characters have the following meaning:

A Added
D Deleted
U Updated
C Conflict
G Merged

4. status: See an overview of your changes:
$ svn status
If you run svn status at the top of your working copy with no arguments, it will detect all file and tree changes you’ve made.
Most common status codes that svn status can return:
‘ ‘ ## no modifications
A mydir/foo.h ## file is scheduled for addition, this is new file, not in the repos
C mydir/test/bar.c ## file has conflicts from an update
D mydir/fish.c ## file is scheduled for deletion
M bar.c ## the content in bar.c has local modifications
? foo.h ## item is not under version control
! bar.h ## item is missing (removed by non-svn command) or incomplete

5. diff: To see details of your local modifications:
$ svn diff

Output is displayed in unified diff format. That is, removed lines are prefaced with a – and added lines are prefaced with a +

6. revert: Undoing Working Changes
$ svn revert bar.c
Subversion reverts the file to its pre-modified state by overwriting it with the cached copy from the .svn folder.
By mistake you removed a file from version control:

$ svn status bar.c
bar.c

$ svn delete bar.c
D bar.c ## D: status code for delete

$ svn revert bar.c
Reverted ‘bar.c’

$ svn status bar.c
bar.c Read more