Dude, "Use versioning - everywhere!"

Seriously, just initialize a local hg/git/fossil repo and commit your stuff now and then. They say "commit early, commit often" but if you had made a commit before doing your modifications you could have gone back to a known good state with a single command.
Also moving stuff around is nicer as any copy/clone of the repo has the history of all the changesets. Merging can get a bit fiddly but having the history* is a nice addition to the comments every code is lacking ;)

*) of course, there's this problem&hellip;: https://xkcd.com/1296/