You realize you've gone down the completely wrong path in your code and basically have to scrap what you've been doing and start over...but you feel bad about all the work you've done and tell yourself there's a slim chance it could be used someday, and so you save your work in another file?
You're describing what I usually refer to as 4:30PM.
Absolutely! I've done this more times over the years than I care to admit (if I did, I might cry!). It's almost always helpful to analyze your decisions to see where you went wrong though...so...
Looking back on the work you did. In the beginning, what made you decide to go down the road you did? Was there information that pointed you in that direction?
I own that t-shirt for sure :)
Even if you'll never use it in production, it's good material for learning and optimizing future strategies. I usually create an alternative git branch to save such a branch.
Absolutely. I really try to focus on what I learned in the process.
Oh yeah. It took me years to stop hoarding pieces of my code. But now I try to clean it up right away. It's nearly never practical to go back to your old code and try to make sense of it.
Anyway, it's never a waste of time. It's called a learning process.
Yes I do this all the time. Except I often forget to save the new file after pasting my code, and if I do save it, I'll never use it anyway.
I feel like there is actually nothing wrong in that
You shoud not complain about the work you lost, but be happy about the time you saved using a different approach.
I do the opposite, I throw away that code and then actually need it afterwards so I shoot myself in the foot twice.
I've done this quite sometimes.
Even though, it might have been a better solution to keep it in a different git branch, instead of another folder.