How to recover a notebook emptied after kernel crash?

If none of the above helped, I found a workaround to recover most of the changes I did since the last checkout - by simply calling this command in your notebook:

%history -g

If you want your IPython history in a plain-text file, you can export it yourself.

You can also do it for a specific filename:

%history -g -f filename 

What does -g do? – Without -g it exports the history for the current session. With -g it exports history for all sessions.


You can check in .ipynb_checkpoints/ in the folder where your notebook was for recent enough version of IPython.