In such a case, use the backup application “Time Machine” built into Mac OS X to restore the file.

Mac Backup - Time Machine Preferences

Taking backups manually is troublesome and can be easily forgotten, so if you are a Mac user, be sure to set up Time Machine, which automatically backs up your files.

Restore files backed up by Time Machine

If you’ve created a Time Machine icon in Doch, click it. Then, it enters Time Machine like this, so See here for other Time Machine usage and settings.

Mac - How to use and set up Time Machine