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?
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.