# Using rsync to push code to a server
Today I learned for the first time about rsync
. I've always just been using
scp
to copy files to a server. Today when I was trying to figure out how to
also delete files on the server that were deleted locally, I found out about
rsync
and how it's a much better alternative!
The nice thing about rsync
is that it only sends the differences of the files
over the network instead of copying over all of the data of each of the files
every time. It also has a --delete
option that deletes the files in the
destination directory that aren't in the source.
Here is how I use rsync
to sync a directory between my local machine
and a remote host:
rsync --delete {{path/to/local_directory}} {{remote_host}}:{{path/to/remote_directory}}
Newsletter
If you'd like to subscribe to my blog, please enter your details below. You can unsubscribe at any time.