Frequently used Top 10 SVN Command examples
SVN commands are used by most developers when there is project development involves multiple locations by different teams.
I am listing down 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.
It displays 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 the 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:
add
blame (praise, annotate, ann)
cat
changelist (cl)
checkout (co)
cleanup
commit (ci)
copy (cp)
delete (del, remove, rm)
diff (di)
export
help (? h)
import
info
list (ls)
lock
log
merge
mergeinfo
mkdir
move (mv, rename, ren)
propdel (pdel, pd)
propedit (pedit, pe)
propget (pget, pg)
proplist (plist, pl)
propset (pset, ps)
resolve
resolved
revert
status (stat, st)
switch (sw)
unlock
update (up)
Subversion is a tool for version control.
This command does list down all the available commands such as Add, checkout, etc. in svn client tool.
How to Checkout from SVN
Checkout means creating 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 \
http://www.techrockz.blogspot.com/svn/myrepo/myproject
so you have to check out my project into your local system assuming myrepo is a public repository.
svn co http://www.techrockz.blogspot.com/svn/myrepo/myproject
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 http://www.techrockz.blogspot.com/svn/privaterepo/myproject --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 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
the diff command is used to check the difference between versions
svn diff
Index: First.java
===================================================================
--- First.java (revision 0)
+++ First.java (revision 0)
@@ -0,0 +1 @@
+This is a comment added for svn-basics.
Property changes on: First.java
___________________________________________________________________