How can I undo editing an indexed file in Git?

52 Views Asked by At

This looks strange but I don't understand what happened.

I was checking the gitdiff using vimdiff (using vim-fugitive). Then, while being in the indexed buffer, I presed dp which should put the changes in the indexed version into the working version. I pressed something afterwards, by mistake, that I can't recognize then the indexed buffer was deleted and it became empty. I closed that window. Now when I run gitdiff again, the whole file in working copy is added as it is compared with an empty file.

I don't know what happend and how can I fix it.

1

There are 1 best solutions below

0
On

Try a git log in order to see your commit history. Analyse your last commit and check if all it is fine