I did this yesterday. However IntelliJ had my back. It's History feature has saved my bacon on more than one occasion.

One time I was able to go back weeks to fetch some code I'd long since deleted and was nowhere to be found in git.

I have this in my .vimrc which serves a similar purpose:

    " persist undo history to file / across sessions
    set undofile
    set undodir=$HOME/.vimundo
    " max out history length
    set history=9999
    set undoleves=9999999999
    set undoreload=10000

(Don't forget to mkdir "$HOME/.vimundo".)

Combine that with https://github.com/mbbill/undotree and you can easily walk the entire history of every file you edit.