Isn't what version control is for? You could see how the code evolved by looking at its history and combined with meaningful commit messages you can easily identify the original problem and how it got solved.
Commit history is very useful for forensics, and I strongly encourage writing useful commit messages, but if you want to say very clearly "Do not try this!", that shouldn't be buried in history, but be clear in the code itself.
That's not to say the best way to do that is just commented-out code, of course.