PHP Developers Network

diff over FTP
Page 1 of 1

Author:  mecha_godzilla [ Sat Apr 02, 2016 10:04 am ]
Post subject:  diff over FTP


Does anyone know how I can diff files on my local machine and a remote server accessible only via FTP? The problem I have is that my client doesn't have any kind of CVS and I have to do all my development on my local machine before uploading it to their test server, then if everything works OK I have to do the same thing with their live server. A bonus feature(?) of this arrangement is that one of their other developers only works on the live site and never updates the test server with his changes, so I can't automatically overwrite the files on both servers in case I overwrite some of his code. This isn't strictly a Linux question because I'm using OS X, but if there's any Un*x/Linux software available I should be able to compile it.

Thanks in advance,

Mecha Godzilla

Author:  Christopher [ Sat Apr 02, 2016 10:36 am ]
Post subject:  Re: diff over FTP

Have you tried rsync? That is the standard solution for *nix. I use is all the time.

Author:  mecha_godzilla [ Sat Apr 02, 2016 12:25 pm ]
Post subject:  Re: diff over FTP

Thanks - I'll look into that. I think rdiff might be closer to what I want because what I need to be able to do is see whether or not any changes have been made to the files on the remote server before I overwrite them, so that I can sync my local copy of the files before I overwrite the copies on the live server. If rsync or rdiff can compare the file checksums and ask me whether I want the files overwritten that would probably work. What I was hoping for was a networked version of diff, so maybe I could do something like

diff /htdocs/my_web_site/my_script.php

and diff would go and get the file on the remote server for me. Maybe I could do what I want using PHP - loop through all the files and retrieve them via FTP, then pipe the output to diff. Not exactly optimal but it might work.


Author:  Celauran [ Sat Apr 02, 2016 4:03 pm ]
Post subject:  Re: diff over FTP

Still thinking this through, but what if you set up Git on your end (if you haven't already), rsync'ed the live environment to your local, and git diff locally. That would at least allow you to see their changes, merge them in, create a commit for the changes they've made (commit messages would be interesting...), and then add your new work on top. At least have commit history and the ability to revert changes available on one end and get diff in the process.

Author:  Christopher [ Sun Apr 03, 2016 12:18 pm ]
Post subject:  Re: diff over FTP

rsync had a -n dry run flag that will give you the same info (rdiff is not always installed standard). I agree with Celauran that you might want to look at your entire process and incorporate Git into it. There are some major benefits to using Git. You may even be able to use Git hooks to do the rsync part automatically.

Author:  mecha_godzilla [ Sun Apr 03, 2016 2:58 pm ]
Post subject:  Re: diff over FTP

Thank you both for your suggestions. I haven't used rsync before so that's something I need to look at. I use Fossil for version control rather than Git but that's just because I found Fossil easier to get on with - I do have Git installed though. So, I guess I need to do some reading up and report back - thanks again for your help.


Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group