Code Snippets

Merging Code Differences with RSync

Rsync is a tool that can find files that need to be transferred using a "quick check" algorithm that looks for files that have changed in size or in last-modified time. Its a fast and efficient way to merge two different code bases without having to use ftp or any diff program. For further information, refer to this blog post.

First to install rsync you can use the following commands.

sudo apt-get install rsync


yum install rsync

Once Rsync is installed. You can type rsync -man to see all the options available to it. Here is an example of Rsync:

rsync -r -v /var/www/vhosts/site2

This example will merge the code from site1 on the remote server to site2 on my local. Using the -v specifies verbose and -r is recursive.

rsync -r -v --exclude “sites/default/files” /var/www/vhosts/site2

This example will merge the code from site 1 to site2 but will also exclude the directory “sites/default/files”.

Resource Tags: