I use Jupyter notebook. I accidentally deleted a cell, and I can\'t go step back.
How can I recover the notebook cell?
if you've already restarted your kernel then %history
or _ih[:n]
would be empty. You can hope for a recent checkpoint to revert to. You can do this with File > Revert to Checkpoint.
If you want to be sure what's in the checkpoint before you revert - in your working directory (the one your notebook lives in) you'll have a hidden folder that stores your checkpoints. cd .ipynb_checkpoints
will get you there. You can look inside the file and see if your lost code is there.
This has just saved me. Found this in an answer here