I do not know of any way to do this.
But to prevent it: Take backups. Go easy on the 'delete' button [specially shift+delete]
Rescue: Rewrite the code, and benefit from having a good idea how to implement the solution to your problem. The first and initial way to solve a problem is not always the best.
![]()