Basically, undo trees can be persisted across vim sessions. Have a read via ":help undo-persistence".
[1] https://github.com/mbbill/undotree
[1] https://github.com/mbbill/undotree