Using .gitignore with rsync not working correctly

Viewed 175

I am trying to use my current .gitignore with rsync, and I've come up with this command:

rsync -avz --filter=':- opensource/.gitignore' opensource/ testing

But if I have a folder on my source that IS NOT in .gitignore and I delete it on the source, in the destination it doesn't get deleted. For some reason, if I add that folder to .gitignore and use rsync -avz --delete-after --filter=':- opensource/.gitignore' opensource/ testing the folder still gets deleted on the destination, even tho it should be ignored.

Am I using this correctly? My objective is to simulate a git pull using rsync.

0 Answers
Related