CVS will solve this problem. The idea is to keep every copy of the file every time you change it.
Which isn't what happens, of course. (The argument against this is that it requires a lot of disk space. Who cares? Isn't your work worth more than disk space?). There are optimizations. Instead of saving complete copies of the file you save the changes between the last copy and the current copy (the ``diff''). And you only save copies that you ``check in''.