Using Subversion for web development

Now that you have imported your files to the repository, you might be wondering how to leverage version control to your advantage. First thing you need to do is set up a Development area and a Live area.

For example:

  1. Log into your server via SSH.
  2. Backup your site by running the following command:
    [server]$ tar -cvf yourwebsite.tar example.com/
  3. Checkout your repository to your development area:
    [server]$ svn checkout http://example.com/yourProject $HOME/dev.example.com
  4. Checkout your repository to your live area:
    [server]$ svn checkout http://example.com/yourProject $HOME/example.com

Publishing from Dev to Live

Using your dev site at dev.example.com, you can now make any necessary changes. Once all the changes are complete in your Dev area, you can then make them Live.

  1. Go to your dev directory:
    [server]$ cd dev.example.com
  2. Commit your changes:
    [server]$ svn commit -m "Your change log notes"
  3. Go to your live directory:
    [server]$ cd ~/example.com
  4. Update the Live site:
    [server]$ svn update

You may see the following error when updating from your dev site:

Conflict discovered in <filename>
Select: (p) postpone, (df) diff-full, (e) edit,
        (mc) mine-conflict, (tc) theirs-conflict,
        (s) show all options:

If you type in the letters tc and click 'Enter' on your keyboard, all changes made in your Dev site are updated to your Live site. View the following page for further details:

Your changes are now live.

See also

Did this article answer your questions?

Article last updated .