This is all explained at http://ultrahigh.org/2012/09/wordpress-development-staging-and-production-deployment/