In this tutorial i’ll explain what is SVN , why we use it and it’s popular commands.
What is SVN
SVN (Subversion) is an open-source version control system. It is widely used for maintaining current and historical versions of files and directories. Using SVN you can track changes in files and directories.
How to Install SVN – Download Guide
How to Install SVN on Ubuntu
# sudo apt-get install subversion
How to Install SVN on Windows
Download the SVN package
according to whether your system is 32 bit or 64 bit. Once downloaded install it and you’r done.
SVN Checkout command
SVN provides checkout command to check out a working copy from a repository.
# svn checkout urlpath
# svn checkout http://svn:8080/svn/current_project
Or instead of writing checkout you can use co as well.
# svn co urlpath
# svn co http://svn:8080/svn/current_project
This command create the new directory current_project in the current working directory.
Svn info command is used to check information such as Date modified, author, revision, path in repository.
It will shows
a) Repository info from which the object is versioned.
b) Most recent commit.
c) Any user-level locks held on the object.
d) Local scheduling information (added, deleted, copied, etc.)
e) Local conflict information.
Go to the current project (working directory) and type svn info, it will display all these information.
# svn info
It shows information such as
Repository Root: http://svn:8080/svn/current_project
Repository UUID: ebb41b07-8871-4b90-CC77-68c30ca78913
Node Kind: directory
Last Changed Author: raj
Last Changed Rev: 3456
Last Changed Date: 2012-11-16 11:34:15 +0530 (Fri, 16 Nov 2012)
SVN commit command
When you made some changes in code then intially it is not save in svn server until you commit your changes through svn ci command.
# svn ci filename -m "comment"
# svn commit products.php -m "comment feature introduced"
Transmitting file data.
Committed revision 3245.
I have made changes in products.php file so i have to commit those changes in svn. After -m switch mention your comment so that whenever you check logs you know the changes you have done in this revision.
SVN add command – Add new file in SVN
SVN add command add new file in svn repository. While working on some feature you have created new file so before committing changes you have to add those files in SVN .
# svn add filename
# svn add file1,file2,file3
# svn add comment.php
I have added comment.php in SVN. Next step is to commit your changes.
# svn ci comment.php -m "comment feature for users"
Transmitting file data .
Committed revision 3269.
SVN status command
It prints only locally modified items.
# svn status
You can use svn st(shorter version of svn status) command for the same purpose.
If you need any help, you can use man command in Ubuntu.
# man svn