Installation
The first step for using Subversion is installing it. This depends on your system. In Ubuntu and Debian, it a matter of running the following command:$ sudo apt-get install subversion
Creating the Repository
The first Subversion tool we will use issvnadmin
. This tool is for administration tasks, like creating repositories, making backup dumps, and the like. To create a repository, open the command line, change the current directory to where you want to create it, and run svnadmin
:$ cd /home/myrepo $ svnadmin create svn
/home/myrepo
)I called my repository svn. You can call it whatever you like. Subversion uses this directory to store information about your projects, like file revisions. You won't need to directly deal with this directory, so I suggest keeping it in a safe place and not tinkering with its contents unless you know what you're doing.
Importing Projects
Now that we have a repository, we will use thesvn
tool to import and manage projects. To import a project, first create a directory for it in your repository. To do so run svn mkdir
:$ svn mkdir file:///home/myrepo/svn/myproj
/home/myrepo/svn/myproj
with the actual path to your repository and the new project name)Subversion will open your default text editor and ask you to enter a log message. Enter an explanation of what you're doing, save, and exit the editor.
Next, it's time to import project files. Change the current directory to the project's directory, and run
svn import
:$ cd /home/myrepo/[...]/myproj $ svn import file:///home/myrepo/svn/myproj
/home/myrepo/[...]/myproj
to the newly-created myproj directory in your repository)Check out, Modify, Commit
As I said, the repository is stored in thesvn
directory which you won't deal with. To work on your files, first you need to check a working copy out of the repository. To do so, use svn checkout
:$ svn checkout file:///home/myrepo/svn
svn commit
in the checked-out myproj directory:$ svn commit
Working with Revisions
Now let's make real use of Subversion. While working with revisions, you can:Check Status
$ svn status <filename>
Compare different Revisions
$ svn compare -r R1:R2 <filename>
Revert Local Edits
$ svn revert <filename>
Revert to Previous Revisions
$ svn update -r R
<filename>
is optional; you can run the previous commands on the current directory if you omit it.Thanks to ayman for this great share.
For more info:
http://svnbook.red-bean.com/
http://trac.edgewall.org/
No comments:
Post a Comment