Last Updated: February 25, 2016
· celc

FTP files recently committed to Git


Ocassioanlly new client has old hosting only accessible over FTP and wants us to perform changes before we've had a chance to migrate them.

git diff 38cfe001a9885cb68bdc42a049d431a920606285..aa64bdf818f0552473288d09487cebe0ba3919dd --name-only --relative --diff-filter=MC |\
xargs -I % curl -u username:password -T % ftp://example.org/public_html/%

This gets us new or modified files in a range, relative from the current path:

git diff sha1..sha2 --name-only --relative --diff-filter=MC

Pipe to xargs and upload with curl, into the target directory.

xargs  -I % curl -u username:password -T % ftp://example.org/public_html/%

No more directory traversal to copy over the 10 files you changes spread over the filesystem.

2 Responses
Add your response


Ah I like git-ftp, a combination of catchup and --syncroot should be able to accomplish what I usually need. I'll try it next time, thanks. :)

over 1 year ago ·