More robustly deal with commits by recovering original file when an error occurs.