How do I find useful code previously deleted but still stored in source control?
svn, version-control
Solution
The most correct answer is: you can't. There are methods to help you with that task, but it is impossible to do the automatically, because:
- you don't know which files it is in
- you don't know the source code or parts of it
- you can't remember when the code removal happened.
- ...
A computer cannot read our minds. That said, there are of course other tools that help you, such as the mentioned ones, or graphical front ends like trac (which I like very much for that purpose).
Problem
Whenever someone asks what to do with code that is no longer needed the answer is usually "delete it, restore it from source control if you need it back". Now how do I find that piece of source code in the repository? Let's limit scope to SVN for simplicity - I suspect that using any other source control system will not make much difference in this aspect (correct me if I'm wrong). If I delete that code and commit the changes it will no longer be in the latest revision. How do I find it without exporting each revision and searching thoroughly (which is nearly impossible)?