Sync SVN Repo to web directory

Often the case, when we work on a project using version control system like SVN, GIT we would like to sync the repository with the web directory so that we won’t require to manually upload files to FTP. Linux has a utility tool rsync which synchronizes files and directories from one location to another while minimizing data transfer by using delta encoding when appropriate. So, what we can do is checkout the svn repository in one of the directories in linux system as the web directory and then use rysnc to sync between the directories.

Let us assume, you have your web directory as /var/www And you checkout svn in the directory /var/svn.

Now, first we need to update the svn repo.

$ svn update /var/svn 

Next, we do rsync

rsync -rutlzh --partial --delete --progress /var/svn/ /var/www

Options

  • -r – -recursive : recurse into directories
  • -u – -update : skip files that are newer on the receiver
  • -t – -times : transfer modification times along with the files and update them on the remote system.
  • -l – -links : copy symlinks as symlinks
  • -z – -compress : compress file data duing the transfer
  • -h – -human-readable : output numbers in a human-readable format
  • – -partial : keep partially transferred files
  • – -delete : delete extraneous files from the receiving side, but only for the directories that are being synchronized.
  • – -progress : print information showing the progress of the transfer.

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

www.000webhost.com