Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you preserve code that DIDN'T work? [closed]

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?

like image 393
Josh Diehl Avatar asked May 08 '12 18:05

Josh Diehl


People also ask

How do you unlock an Excel file that is locked for editing?

Windows: If possible, remove password encryption or restricted access from the file. Go to File > Info > Protect Workbook and remove any passwords or restricted access settings.

Where are unsaved Excel files stored?

Choose “Recover Unsaved Workbooks” to display and recover unsaved Excel files. Excel saves unsaved files to the folder C:\Users\\AppData\Local\Microsoft\Office\UnsavedFiles. You can also access the files from this folder.


1 Answers

Branches!

  1. Use branches liberally ( jQuery_slider_nivo, jQuery_slider_zurb, etc )
  2. You're right that stash is not the place to be storing this code for a length of time
  3. If you want to check the code simply switch to that branch
  4. If you want it back in simply merge the branches

Also you can perform archive operations ( $ = console ):

  1. Archive it: $ git checkout -b archive/<branchname> <branchname>
  2. Delete it: $ git branch -d <branchname>
  3. Restore it: $ git checkout -b <branchname> archive/<branchname>

where <branchname> == TotallyAwesomeBranchName

... or whatever you name your branches =]

like image 100
carl crott Avatar answered Nov 05 '22 22:11

carl crott