20Dec/060
Rsync code to remote server
Rsync is a great way to sync your code with a server. Whether you work from a local copy, or just edit locally, Rsync is a speedy way to to get the job done. Here is a useful unix alias.
alias XXX='rsync -cuar --progress --exclude-from=/PATH/TO/WORKING/COPY/push.excl /PATH/TO/WORKING/COPY/ USER@SERVER.com:~/PATH/TO/REMOTE/COPY && date'
Add that to your .bash_profile or .bashrc file in your home directory. XXX is the alias, what you type into your terminal to sync everything up. You should make it project specific, like 'rsgt' short for Rsync GearTracks.
The "-cuar" options are
- checksum- just a check that all the data gets uploaded OK
- update- do not overwrite newer files on the server
- archive- archive mode, general settings, follow symlinks, etc
- recursive- sync contents of directories as well
"push.excl" is an exclude file, filled with names of files or directories that you don't want to sync up to the server. Here is the push.excl from a Rails project:
.svn config/database.yml db/schema.rb push.excl tmp log
You also need to have the path to the working copy, your username and the server name on hand.
For more info, Wikipedia on Rsync is pretty complete.