I'd like to update a live website in an atomic way. If we've made several changes to pages, images, and javascript, all of the changes should appear simultaneously with no downtime, inconsistency, or 404s.
If I simply copy the changed files into the website directory, then at least a few requests will see an inconsistent site. If I copy the new site to a separate directory, then rename the old directory to take it out of production and rename the new directory to make it live, then for one brief moment we'll get 404s.
I really have two questions:
How can I update a directory of files in an atomic way?
How can I coordinate this with Git? We'd like to deploy using a git pull (or possibly push). The path of the site within the git repo is different from the path on the server, so a bit of moving/renaming needs to happen, either using git commands or OS commands.