skip to Main Content

I accidentally deleted a piece of code on Visual Studio Code. I haven’t closed visual studio yet.

CTRL + Z doesn’t work. Edit + Undo doesn’t work either. The variables are still stored.
It was accidental. I just happen to close a jupyter notebook box

Any idea how I can recover thank you?

3

Answers


  1. Chosen as BEST ANSWER

    There is a way to recover the deleted code if CTRL +Z doesn't work.

    You can click right on the .ipynb script, open chronology then go to your last changes and click on it. You will then see the deleted part.


  2. Cannot get it back if you have not backed up.

    Login or Signup to reply.
  3. Good question, happens to most of us when working longer and not paying attention.
    Vscode starting from a specific version does internal management of your code (March 2020 release). This feature is called timeline.

    What to do:
    Right click on your .ipynb file > Open Timeline > Restore contents on a specific version of your file.

    Also, before restoring, would suggest that you check out the version you’re going to restore by comparing it with the current one.

    Note: This does not require the git repository to be active at the time of the incident. As this is what Vscode is technically doing by itself.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search