While developing, I will sometimes try a technique or method that doesn’t pan out right away. Once I decide to move on to another task or try another technique for the same task, I’m never sure what to do with the non-working code. I want to keep it as a record of what I tried, so I know what didn’t work or even as a starting place for trying to make it work again.
Usually I just leave the code in place, commented out and uncommitted to VCS, for some length of time. This becomes a pain however as it clutters code and has to be dodged on VCS commits. I happen to be using git which has a “stash” function for temporary storage, but I’m not sure if that’s an appropriate use.
How do you handle code you want saved for posterity, but don’t want as part of your mainstream code base?
Branches!
Also you can perform archive operations ( $ = console ):
where <branchname> == TotallyAwesomeBranchName
… or whatever you name your branches =]