You could look into version control software, like SVN. They can be configured to save older versions of files, create "build snapshots" of the code, and various other things. You can then revert easily.
However, because I can't be bothered with that, once I get to significant builds in my code, I just copy it each week into it's own back-up folder. Then I know I can just delete my current folder and drop the old one in, complete with media, files and code, and it'll work. Plus I find it easier to compare when they're two physical folders on disc.