How to split or merge a notebook?

Say I’m writing a notebook and at some point realize that some of its cells should go elsewhere or that it’s too long and I should split it in two. Is there a way to do (and undo) this?

I guess one option would be to fork it, delete everything before and after those cells and do the opposite in the fork. However, I’m not sure there would be a way to undo this process.

I think one way to implement this would be to allow copying and pasting cells in Visual mode.

1 Like

Hi @nachocab,

Forking a second copy and then making your desired edits to each is probably the easiest way to achieve this. (You can also, of course, import some cells from one notebook into the other.)

In the original notebook, you can undo this process by going back in your notebook’s history:

Thanks, Jeremy. When you say “import”, do you mean copy and paste the text in each cell or am I missing something?

You can import a named cell into another notebook to reference its value (without copying the code):

1 Like