MacOS – Restore file to previously saved version

filemacosterminal

Hey guys so I was using Xcode as a text editor to write a C code, and without paying attention I deleted the whole code I had on the file and somehow it got saved that way. When I noticed this (the code was not there), I exited my editor without saving, but when I opened my file again it opened the deleted version already.
I am freaking about because I was supposed to send the code in today and my work is just gone.
I saw a couple of posts on similar situations, but the answers depend on what text editor was being used. In one answer I was there is a 'revert to saved' but this only puts me back to the deleted version, not to anything before this. Please help.

Best Answer

I managed to figure it out. Fortunately I am a mac user and I was able to use Time Machine to help me sort this out!.