Lost your uncommitted changes in Git? There is a FIX!!

Rajdeep Chandra
2 min readFeb 3, 2023

--

Well to be honest we all have a tendency to close the laptop after a day’s work without committing the changes to GIT and there can be n number of files waiting to be staged before you log off for the day.
There can be many reasons to loose track of your files and your changes but either way it sucks.
git reflog and git log will not be able to save you here.

I was in this situation a few days back and I literally panicked since none of the git commands seems to return me the updated code in the files. I went through stack overflow and even asked chatGPT but couldnt get help on this.
After a lot of juggling through multiple tech blogs and channels I figured out a way to revert or see my changes from the history in VS code.

Thank me later!!!

This is how you should do it.

The Solution:

You must remember every file name which you have changed.

Step 1: Enter Ctrl + Shift + P on VSC

Step 2: Choose the option “Local History: Find Entry to Restore”

Step 3: Find the file which you want to restore

Step 4: Choose a time you save that file

Step 5: Copy file content and restore it

If this didnt solve your issue feel free to drop a note on rajrock38@gmail.com

--

--