Doing a Git stash, or anything git related deletes the entire undo tree
I have lost hours of work because of this in the past and it continues to happen.
It super frustrating, I know need to re-write an entire file which is going to delay my work.
I dont understand why doing any kind of git movements like git stash or git checkout etc completely deletes the undotree.
Is there something you can do to prevent this on your side?
Thank god I had an opened nvim and I managed to recover this file...
Why is it that if I close nvim , do some git actions and then open it the undofile gets competely deleted?
I cant find anything about this behavior online
Glad to hear you've got your data back. I've been there and I know how it feels when important data got lost like that. I think it's an VIM internal behavior but I can't find anywhere mention it in the vim documents. I did find some user wikis mentioned it though, e.g. https://vim.fandom.com/wiki/Using_undo_branches
However, note that if a file is modified externally without Vim, Vim will not be able to read the undo history back when you start editing the file again and the undo tree information will be lost. There is no way to get it back.
One of the safeguard is to enable the backup file. I personally do not use it as I'm aware of the above mentioned behavior but you can try if you're unsure.
So how do you prevent these issues?
I found that page and I enabled this backup stuff and swap files just in case.
On Fri, Jan 27, 2023, 21:37 Ming, Bai @.***> wrote:
Glad to hear you've got your data back. I've been there and I know how it feels when important data got lost like that. I think it's an VIM internal behavior but I can't find anywhere mention it in the vim documents. I did find some user wikis mentioned it though, e.g. https://vim.fandom.com/wiki/Using_undo_branches
However, note that if a file is modified externally without Vim, Vim will not be able to read the undo history back when you start editing the file again and the undo tree information will be lost. There is no way to get it back.
One of the safeguard is to enable the backup file. I personally do not use it as I'm aware of the above mentioned behavior but you can try if you're unsure.
— Reply to this email directly, view it on GitHub https://github.com/mbbill/undotree/issues/146#issuecomment-1407098710, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7WGR5JOMTEACJ7ARPROHTWUQ5YTANCNFSM6AAAAAAUI2RMUI . You are receiving this because you authored the thread.Message ID: @.***>
So how do you prevent these issues? I found that page and I enabled this backup stuff and swap files just in case.
You mean me or the undotree plugin?
You because from what I understand there's nothing the plug-in can do right?
On Sat, Jan 28, 2023, 01:11 Ming, Bai @.***> wrote:
So how do you prevent these issues? I found that page and I enabled this backup stuff and swap files just in case.
You mean me or the undotree plugin?
— Reply to this email directly, view it on GitHub https://github.com/mbbill/undotree/issues/146#issuecomment-1407237876, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7WGRZUE3C3W2HLB3MROWDWURW35ANCNFSM6AAAAAAUI2RMUI . You are receiving this because you authored the thread.Message ID: @.***>
You because from what I understand there's nothing the plug-in can do right?
That's right. I'm not seeing this issue very often because the way I use the undotree with git is a bit different. The undotree handles small changes within an edit session, and git takes care of the larger changes throughout the repo. I always double-check and make sure all opening editors are either saved or closed before running git commands.