HACKER Q&A
📣 ajdruff

How do you manage your abandoned code?


There are times that I have invested quite some time into a chunk of code and realize that sometimes its just better to abandon it entirely and try a different approach. This code often contains useful techniques that don't always get carried over to the final release.

The thing that bothers me is that many times I suspect I wasn't too far off in solving the sticking point, and I sometimes find myself wondering if my initial approach wasn't the better one.

My current solution is to try to move all such code into a private repo for later review, but I don't always have the head-space to interrupt my work and manage that overhead.

What are your techniques or tools that you leverage in managing your abandoned code? Do you commit it somewhere for a later review by yourself or a team member? Do you just git stash and move on?


  👤 simonblack Accepted Answer ✓
I never destroy the source code directory. I still have projects from 30-odd years ago that get looked at from time to time for some silly reason or other.

I move the project directory out of the main work area where current projects live to another area like 'obsolete' or perhaps 'non-current'. It still exists, but it isn't continually in your vision.

Disk space is cheap. Your time and angst are not.


👤 coderintherye
Putting it in a "Gist" is pretty easy on github: http://gist.github.com/ (note use "create secret gist" for code you wish to keep private)