Vim has this, it's :earlier and :later

https://vimtricks.com/p/vimtrick-time-travel-in-vim/

    :earlier 3 – Undo the last 3 changes
    :earlier 5m – Go back to the state of the file 5 minutes ago
    :later 2 – After undoing something, redo the next 2 changes
    :later 1h – Travel forward through the change history 1 hour
Vim also stores the tree of changes, but it's a pain to access without plugins.

Wait until you see what intellij can do. It can do that, while also layering it in a logical, graphical diff viewer

Vim has a plugins for that. ;)

I use https://github.com/mbbill/undotree but if that's not to your taste there are many others.

e.g. https://docs.stevelosh.com/gundo.vim/