From version 0.4 onwards, undo-tree supports persistent storage of undo-tree data between sessions “out of the box”. (Note that there are significant bug-fixes related to this feature in more recent versions; the latest version at the time of writing is 0.6.3.)
Simply enable the undo-tree-auto-save-history
customization option to automatically save and load undo history in undo-tree buffers. Or use the undo-tree-save/load-history
commands to save and load undo history manually.
You need at least Emacs version 24.3 for this to work reliably, but with a recent enough Emacs it works very well.