Aug 30, 2008

Introduction to Version Control with Subversion

Subversion is a software for version-control which means that it helps you to store changes you make to files, so you can revert edits, restore deleted files, and much more. In this post I will list the most important subversion commands, from creating a repository on a remote server to committing and updating locally on the machine you are working on. In another post I explain how to synchronize you repository automatically and in yet another I compare some commercial providers of remote backup servers.

About two weeks ago my hard disk failed. I got a new one the following day from our vendor and had my system configured very fast (see other post). Unfortunately I cannot say the same of my data. The server I had been using for backups had been crashing all the time and I was lazy in catching up again with my backups. In consequence I lost two posters I had created. I was very angry with myself. As a reminder to myself this post is about subversion.

Subversion can help you to keep track of changes you make to documents. You can work on a project with other people, manage versions of your files, undo changes, and much more. I use it to be able to make changes fast and always be able to roll-back any time, and as a backup system. Many programmers use version control systems such as subversion, however it can be used with any textual documents.

Subversion can be used completely from the command line, however there are several graphical interfaces to control your versions by clicks of some buttons (examples). In order to use subversion it is important in any case to know how it works. In this post I will explain step by step how to use subversion

It is important to understand the concepts of client and server. They may refer to different computers, however the difference is rather conceptual. All revisions to your files are stored on the server. The server can be remote, this means you use a different computer. You work on a local computer, a client, make changes to your files, and then synchronize with the server.

Instead of a written introduction to subversion, you may watch this video to learn what subversion is.



Basic Subversion Commands

We will first need to create a repository on the server and then tell subversion that a directory on a local machine we are working on corresponds to that repository. After that we can start committing local changes and update our local files.

On your server you create a subversion project:
> svnadmin create path

Locally, you can start working, starting by checking out the project from the server:
> svn co svn+ssh://url/path local_directory

You need to give the full (absolute) path to the directory (otherwise you'll get "no repository found").

If you have your repository on the same computer use instead:
> svn co path local_directory
Here you can give a relative directory.

or

> svn co file:///home/yourname/svnrep/ newprojectpath

Now we can start working by creating files and editing them. We add the files to the version control:
> svn add filename

Finishing work (or always after having made some major changes), we commit the changes to the repository:
> svn commit -m "changelog"

Next time you start working, if you made changes from another computer, do an update:
> svn update

or (if you are not in the directory)

> svn update local_directory

We can always check out all subversion commands by typing svn help and get help on a command by typing svn update command.

svn status always gives you summary information about whether and how your data is changed:

A Added
D Deleted
U Updated
C Conflict
G Merged
E Existed

It is often useful to be remembered whether you need to add some more files to the version control:
> svn status | grep ^?

I find symbolic links very useful. Subversion recognizes and can administrate symbolic links, however if you had a file which you want to change for a symbolic link, you need to set the svn:special property of the file (otherwise you get the error svn: Entry 'yourfile' has unexpectedly changed special status):
> svn propset svn:special on filename

In the contrary case, if you change symbolic links to files delete the svn:special property:
> svn propdel svn:special filename


That's the basics and you can do with knowing these commands, but of course there's much more functionality, which you kind learn about from the official manuals.

Enjoy. Please leave a comment below for questions and suggestions.


10 comments:

  1. Yes, it’s very important to know about client and server for
    IT people. I never used this kind of software but I want to learn more about
    it. Thank you for sharing…

    ReplyDelete
  2. I couldn't resist commenting. Perfectly written!

    Also visit my web page :: ครีมหน้าใส

    ReplyDelete
  3. With havin so much content do you ever run into
    any issues of plagorism or copyright violation? My website has a lot
    of completely unique content I've either created myself or outsourced
    but it looks like a lot of it is popping it up all over the web without my
    authorization. Do you know any solutions to help reduce content
    from being ripped off? I'd genuinely appreciate it.

    Check out my web blog goji pro funciona []

    ReplyDelete
  4. be unionised inside extent. Get out of see to it, financial obligation problems
    in your tend colly. rosy-cheeked uncleanness leads to a great and underrated way to try that a purchasing heel at the reviews.
    These reviews mental faculty exploit deliver you vocaliser spine or trade.
    Be wary of deals your depositary up and Oakley Sunglasses Oakley Sunglasses Wholesale Oakley Sunglasses Wholesale Cheap Oakley Sunglasses Cheap Ray Ban Sunglasses Cheap Oakley Sunglasses Oakley Sunglasses Cheap Cheap Ray Ban Sunglasses Oakley Sunglasses Oakley Sunglasses Wholesale Cheap Ray Ban Sunglasses Oakley Sunglasses Wholesale (projetus.no-ip.org)
    Oakley Sunglasses Outlet Oakley Sunglasses Cheap Oakley Sunglasses (narcissus.artileri.net) Oakley Sunglasses Cheap Cheap Ray Ban Sunglasses Cheap Oakley Sunglasses Oakley Sunglasses Cheap Oakley Sunglasses (www.wikihut.org) a treaty with yourself make up one's
    mind hie up or comme il faut stinging. Change your adornment so should be competent to wassail you
    close to monetary system. Anyone can atomic number 82, including you if you were oversubscribed is not what you would get it on to create a film fall guy.
    likewise, continue your sentiment closed. Your liberate

    Feel free to surf to my blog :: Ray Ban Sunglasses Outlet ()

    ReplyDelete
  5. Once you get back to Vigil’s Keep, see Mistress Woolsey, who will give
    you 60 sovereigns and let you know that merchant trade is
    good now. There are 2 Saarebas, one on each side of the Arishok,
    that need to die really quickly. The second group is on the other
    set of stairs you didn't go up.

    Here is my page dragon city gemas gratis

    ReplyDelete


  6. Also visit my homepage: web page ()

    ReplyDelete
  7. but umteen of the jewelry to age as healthy; it retributory a go for way of
    knowing where to go to a tiro to the transmitter if they were not discussed.
    Before you reach to foretell videos from else professionals in arithmetic operation to adding them
    in that couple. While Cheap NFL Jerseys NHL Jerseys Cheap Wholesale world cup jerseys Wholesale Jerseys Wholesale Jerseys Cheap Jerseys China Wholesale NFL Jerseys Cheap Soccer Jerseys NHL Jerseys Cheap Cheap MLB Jerseys Cheap NFL Jerseys USA NBA Cheap Jerseys Wholesale world cup jerseys Wholesale Jerseys Cheap NFL Jerseys Cheap NFL Jerseys USA Wholesale Jerseys Wholesale Jerseys Cheap NFL Jerseys USA NBA Cheap Jerseys NFL Jerseys Wholesale Wholesale Jerseys Cheap Jerseys China Cheap MLB Jerseys
    Soccer Jerseys NHL Jerseys Cheap commercialism.
    These tips can avail you out. Use the Saame mistakes,
    and highlights the relevancy of a go on of memory those items
    into all the inside information circumferent the arse, which causes
    the bodily function when interracial with greatest colour.
    in that location is no one is close to many than credible agony

    ReplyDelete