First, we need to check you have rsync on your development machine (not your production server). To check, open up a terminal and type
rsync --version
You should get a little message back that looks like this:
rsync version 3.0.9 protocol version 30
Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Then some other text. If this doesn't happen, you need to install it. (Not sure where from, it was already on my Mac)
Note: I did once find a RackSpace server which wouldn't allow me to use rsync to transfer to, I had to install rsync on the server as well, let me know if you have this problem.
Great! I'm going to assume the following:
You have a web project on your machine.
You have a web server that you can access via SSH.
You may have local files you do NOT wish to transfer.
You are vaguely comfortable typing things into a terminal.
Ok, this is what the command looks like:
rsync -vrcn --exclude-from=/path/to/exclude /local/path/to/projects/project/ username_for_server@server_ip_address:/full/path/to/project/
Copy this out and put in your text editor so we can go through it
Let's break it down:
-vrcn
V for Verbose. R for Recurse through directories C for use Checksum to compare the changes (for some reason this works best for me) and N means don't ACTUALLY copy anything just tell me what changes will be made.
When you're ready to copy files, use -vrc instead of -vrcn.
ALWAYS use -vrcn to check what will be copied BEFORE you copy it. This is great for seeing how out of date your production environment is.
--exclude-from=/path/to/exclude
Put the filenames of files you do not wish to transmit in a file called 'exclude' somewhere and put the full path in place of /path/to/exclude
You can use * in your exclude file as a wildcard. There are loads of tutorials on exclude files, I won't go into details here.
/local/path/to/projects/project/
Change this to the full path to your project you want to copy
username_for_server@SERVER_IP_ADDRESS:/full/path/to/project/
Change username_for_server to the username given to you by your hosting company
SERVER_IP_ADDRESS should be your IP address of the server also from your hosting company. If you have DNS set up, you can just put the domain like www.whatever.com
/full/path/to/project/ should be the directory on the server which is the online version of your local directory. If you are on shared hosting, you'll probably have to put /home/your_user_name/ at the beginning, this is fine.
Note: make sure you leave that : before you put your directory
I like to paste my command into a text editor so I can get it right before running it in a terminal. As long as you leave that n in the -vrcn, it will always be doing a simulation not the actual copy.