How do I force Jupyter Lab to revert a file

1.1k Views Asked by At

I have a Jupyter Notebook open in Jupyter Lab. I run black to reformat the code in the open Jupyter Notebook. If I try to save the file, Jupyter Lab raises

"notebook.ipynb" has changed on disk since the last time it was opened or saved. Do you want to overwrite the file on disk with the version open here, or load the version on disk (revert)?

How can I revert the Jupyter Notebook without try to save it?

2

There are 2 best solutions below

0
Raniere Silva On

I found the answer at File > Reload from Disk.

enter image description here

0
math_user On

I found a solution to the problem.

Go to Kernel pull down menu, select "Restart & Clear Output". Then, the Jupyter Notebook will be restored to initial status, and all output will be erased.

Please see attached picture